Sometimes, when you are troubleshooting you forget the obvious in search of more complex reasons. Recently I had a case of that where an Episerver site kept redirecting the moment it was launched.

Basically this is one of the blog posts I'm simply writing as a little reminder to myself and others that need reminding sometimes in the future when they run into this scenario:

I had gotten an Episerver code-base and database from someone else and was running it locally in my environment, using IIS Express along with visual studio.

Every single time I would run the project in visual studio, I would be met with a browser that instantly redirected to another host/port than what I was running - and since my IIS Express obviously wasn't hosting anything at the redirected host/port it would fail. Obviously the simple fix was just to reconfigure my Project to ensure IIS Express used the proper port, right? But it still bothered me and decided to see where the redirect was coming from. Developer Tools in Chrome showed it being a clean 301 redirect at first request.

First thought: Maybe this is a web.config thing like HSTS. Maybe it's redirecting to ensure HTTPS and somehow a hardcoded hostname has snuck it's way in there? No luck.

Second thought: Could this be some mysterious configuration in a VS .suo file or similar that had somehow been forgotten in the gitignore? Looked through various hidden files (lots of fun files in the ".vs" folder as well) and user config files. Sure, some host names were listed but nothing that would explain this behavior. 

Third thought: Aha! The good old 404 Redirect plugin is installed. Could this have gone rogue and decided to mess with things? Checked the database and it's configuration - everything in order.

Fourth thought: Some kind of custom http handler / module must be doing something strange. Searched through the entire code base for the hostname/port, no luck. Created a new init handler and put a break point at the start to see if it would get hit in debug. It didn't - redirect happened before.

And then it dawned on me...



Obviously followed by me doing something like this:


Lesson to learn: When in doubt, go for the most obvious first - And with Episerver good old Admin mode configuration stored in the database is a classic. Second lesson: when it's time for weekend, it's time for weekend.


Post Comments()

You might also like