v7.0.3 In Port Mapped Environment Produces HTTP 301

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
gunter
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 22
Joined: Thu Oct 02, 2008 9:43 pm

v7.0.3 In Port Mapped Environment Produces HTTP 301

Post by gunter » Sun Jun 29, 2014 9:22 pm

Hi,

Scenario:
We have a site with an external port of 443 and internal of 444. This is because our hosting provider only allows a single IP for each server instance.
The site is bound to port 444 and the external port for that IP is destination NAT'd to 443.

Problem:
When we access the site with https://site/, we get redirected to https://site:444/ which is of course not available to the outside world, and shouldn't need to be.
This is done with a "301 Moved Permanently", so I can't even fix it with a URL rewrite.

Is there any way we can stop AbleCommerce from redirecting to the port it's bound to?

Thanks in advance!

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: v7.0.3 In Port Mapped Environment Produces HTTP 301

Post by Katie » Mon Jun 30, 2014 9:36 am

When you had the license key issued, did you actually have the port number included so it was embedded in the key?
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

gunter
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 22
Joined: Thu Oct 02, 2008 9:43 pm

Re: v7.0.3 In Port Mapped Environment Produces HTTP 301

Post by gunter » Mon Jun 30, 2014 9:21 pm

Hi Katie, thanks for the response!

No, the license doesn't include the port number, as it is being accessed without one (I presume this is correct).

User avatar
Katie
AbleCommerce Admin
AbleCommerce Admin
Posts: 2651
Joined: Tue Dec 02, 2003 1:54 am
Contact:

Re: v7.0.3 In Port Mapped Environment Produces HTTP 301

Post by Katie » Tue Jul 01, 2014 3:45 am

Is there any way we can stop AbleCommerce from redirecting to the port it's bound to?
The key has your domain embedded, so if you don't have the port number as part of the domain, then the redirect must be coming from your hosting provider. This doesn't sound like an issue with Ablecommerce. Have you asked your host why this happens:

access the site with https://site/, we get redirected to https://site:444/

You shouldn't want to have any port numbers in the URL, regardless of it being SSL or not.
Thank you for choosing AbleCommerce!

http://help.ablecommerce.com - product support
http://wiki.ablecommerce.com - developer support

gunter
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 22
Joined: Thu Oct 02, 2008 9:43 pm

Re: v7.0.3 In Port Mapped Environment Produces HTTP 301

Post by gunter » Tue Jul 01, 2014 10:14 pm

Thanks again for your response, I really appreciate it.

Unfortunately it must be coming from inside AbleCommerce.
The hosting in this case is a VPS and I have access to IIS and can confirm that other ASP.NET sites in the same setup do not redirect to the internal port.
This isn't uncommon practice, either (it's called destination NAT).

You're right, we really don't want port numbers in our URL, it should be transparent to the outside world.

I know it's a big ask, but maybe you could see if the devs know anything about it?

Thanks again!

gunter
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 22
Joined: Thu Oct 02, 2008 9:43 pm

Re: v7.0.3 In Port Mapped Environment Produces HTTP 301

Post by gunter » Tue Jul 01, 2014 10:50 pm

Thanks for your help, but I have found a work-around.

I created an inbound URL rewrite rule to replace SERVER_PORT 444 with 443 and the site now works!

Anybody else out there with this issue:

Create a blank inbound rule with the following (replace 444 with the port you're using, this works with non-SSL http, too):

Match URL
Requested URL:
Matches the Pattern

Using:
Regular Expressions

Pattern:
.*

(checked) Ignore case

Conditions
Input | Type | Pattern
{SERVER_PORT} | Matches the Pattern | 444

Server Variables
Name | Value | Replace
SERVER_PORT | 443 | True

Action
Action type:
None

(checked) Stop processing of subsequent requests

Post Reply