Dashboard Redirects to Production URL from Localhost

Topics: Troubleshooting
Oct 15, 2014 at 7:47 PM
Subject line says it all. When I build the project in Visual Studio and try to log in to the dashboard at /admin/, the URL immediately redirects to our production www.sitedomain.com URL. Anyone else encounter this before or have an idea how I can address this? My log file data appears inconclusive but mentions, "WRN: Assembly binding logging is turned OFF." Related?

Thanks for any advice you can provide.

TD
Coordinator
Oct 15, 2014 at 7:59 PM
Check your settings, look for Base Url in the main screen.
Oct 15, 2014 at 8:10 PM
Alas, I can't log in to the dashboard to adjust this setting for my localhost environment. Can I adjust this setting directly in the DB?
Developer
Oct 15, 2014 at 10:28 PM
Edited Oct 15, 2014 at 10:28 PM
Assuming you're on 1.8 or higher, you can change that setting directly in the database through this table: Orchard_Framework_ContentItemRecord.
Find the record where ContentType_id has the ID of the Site content type (most likely 1). The ID of the record you're looking for is most likely 1 as well. It's Data column will look something like this:
'<Data><SiteSettingsPart SiteSalt="500a71022c854945923db4c16a670bb3" SiteName="ACME" PageTitleSeparator=" - " SiteTimeZone="Pacific Standard Time" SuperUser="admin" SiteCulture="en-US" BaseUrl="http://localhost:30321/OrchardLocal" /><ThemeSiteSettingsPart CurrentThemeName="ACME" /></Data>'
Update that record with the correct BaseUrl value.
Oct 16, 2014 at 2:38 AM
Bingo!

This was a result of enabling the SSL features in production at launch. By removing this code:
<SslSettingsPart><Urls>~/Admin/*</Urls><SecureEverything>False</SecureEverything><Enabled>True</Enabled><CustomEnabled>True</CustomEnabled><SecureHostName>www.mysite.com</SecureHostName><InsecureHostName>www.mysite.com</InsecureHostName></SslSettingsPart>
From the table and row you suggested my problem was solved.

THANKS.
Oct 17, 2014 at 6:41 PM
I have this exact same problem, but the Data column is null in both my production and dev dbs for the site content type id. Any ideas where else to look?
Oct 17, 2014 at 8:02 PM
Ahh, I'm in Orchard 1.4 if that changes anything.
Developer
Oct 18, 2014 at 1:19 AM
Edited Oct 18, 2014 at 1:19 AM
Yes, before 1.8 you would have to look at the Settings_SiteSettingsPartRecord and Settings_SiteSettings2PartRecord tables.
Oct 20, 2014 at 5:01 PM
Hmmm... yeah, found that also. Changed it (Settings_SiteSettings2PartRecord record) in the db, but I'm still getting the redirect.

I've recycled the app pool, restarted the site, double checked that my site settings has the right connection string, deleted cache.dat from the app_data folder. Any other trees to bark up?
Oct 20, 2014 at 5:30 PM
Following up with a few confusing bits, wondering if they make any more sense to you.

In trying to debug this, I've done a couple things:

1) Break the connection string (add random chars to db name) in app_data to try and verify that it's being used. This had no effect, which was a big red flag, but I've verified in IIS that the parent directory is what's being used for the site.

2) Following that test I decided to take the dev db offline. This did break the dev site (no redirect, just a 500) as expected. But that's confusing to me because I have changed (and verified) the Settings_SiteSettings2PartRecord record to the correct dev url in that db I took offline. So I'd expect the redirect to be correct here.
Oct 20, 2014 at 7:01 PM
I'm not one of the geniuses around here but since I started the thread I want to help in anyway I can. The behavior started for me once I enabled the Secure Sockets Layer module. You could try disabling it in your development environment by removing or renaming its folder Orchard.SecureSocketsLayer. Just a thought...
Oct 20, 2014 at 7:08 PM
Thanks for the input... as far as I can tell that module isn't installed. Not in the Modules folder or in the module list on prod.