Search code examples
asp.netvpsnathttp-redirectablecommerce

ASP.NET Site Redirects To Internal Port


Scenario:

We have an AbleCommerce (ASP.NET e-commerce CMS) website which needs SSL (obviously) but is hosted on a server which can only have 1 internal IP address. This would usually be fine, as we can add an external IP and destination NAT the external port 443 to the server's port 4433, for example. This works for other websites, perfectly well.

Problem:

When we visit the site at https://site/, the browser is redirected (by way of a HTTP 301) to https://site:4433/ (which is of course inaccessible to the outside world).

The Question:

Is there any way to configure AbleCommerce to not redirect the user and just use the URL it was accessed by?

Thanks in advance!


Solution

  • 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? This will work with any IIS site which is redirecting to the internal port.

    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