HTTPS URL Rewrite causes duplicate folder 404

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
8/23/2011 2:07:59 AM
Gravatar
Total Posts 3

HTTPS URL Rewrite causes duplicate folder 404

Hey Joe, where you going with that beer in your hand? I'm using URL Rewrite to force HTTPS and I'm getting a duplication of the folder address causing a 404.

Windows Server 2008 R2 SP1

Microsoft SQL Server 2008

Web Platform Installer mojoPortal 2.3.5.8.b .Net 4.0 MS SQL

I used the instructions from here to set up the URL Rewrite for HTTPS. When I disable this rule mojoPortal runs fine. When the rule is enabled I get the following behavior;

request > http://mysite.com/mojoportal redirect = https://mysite.com/mojoportal/mojoportal

Where the suffixing of the additional folder is incorrect and the correct url should be https://mysite.com/mojoportal/

Similarly the following also happens

request > https://mysite.com/mojoportal redirect = https://mysite.com/mojoportal/mojoportal

 

Help me Obi-Joe Kenobi

8/23/2011 6:40:18 AM
Gravatar
Total Posts 18439

Re: HTTPS URL Rewrite causes duplicate folder 404

Hi,

You don't need to use an url re-writer for this. If you have an ssl certificate installed just set 
<add key="SSLIsAvailable" value="true"/>

in Web.config or user.config

then by default mojoPortal will force ssl on pages such as the registration and login pages and user profile, and also a setting will then appear in Site Settings if you want to force SSL on all pages in the site, and if this is not checked then you will see a setting in Page Settings for each page so you can specify which pages should use SSL on a page by page basis.

Hope that helps,

Joe

 

9/2/2011 5:49:36 PM
Gravatar
Total Posts 3

Re: HTTPS URL Rewrite causes duplicate folder 404

Ok, tried it your way and it works, kinda. However if you request a resource without specifying that you want to use HTTPS in the request mojo will rewrite the URL prefixing the HTTPS but duplicating the name of the application in the URL.

So with <add key="SSLIsAvailable" value="true" /> and Require SSL on All Pages? checked  

http://mysite.com/portal becomes https://mysite.com/portal/portal and consequently fails.

Maybe it's to do with the fact that during the the install using Web Platform Installer I specified portal as the application name which means the mojoPortal is one level down from the Default Web Site.

9/7/2011 1:15:50 PM
Gravatar
Total Posts 18439

Re: HTTPS URL Rewrite causes duplicate folder 404

Hi,

Sorry for the delay in getting back to you. I recreated this configuration on my local machine today and was able to see the problem. When I investigated the code I found there is already a solution for this built in but it wasn't documented anywhere. I guess it hasn't come up much because most people who use an SSL certificate do install it as a root level site.

If you add this to your user.config file it should solve the problem

<add key="IsRunningInRootSite" value="false" />

Note that you'll need to touch the Web.config file after that because it won't automatically detect changes in user.config.

I've added a note about this to the section about SSL on the Securing mojoPortal article.

Hope that helps,

Joe

9/8/2011 6:20:37 AM
Gravatar
Total Posts 18439

Re: HTTPS URL Rewrite causes duplicate folder 404

Many thanks for the beer Jules!

Cheers,

Joe

You must sign in to post in the forums. This thread is closed to new posts.