Search code examples
language-agnosticmod-rewritehostinginfrastructure

Creating a stage environment on network with port 80 blocked


I currently use my local web server to allow costumers to preview some applications and also to allow downloads of "nightly builds" of my open source library.

Problem is I changed my ISP and now my port 80 is blocked.

Altough I know I could easily change the port on the Apache server, I'd like to avoid that unless there's no alternative.

Do you know any third party service (free or paid) that would do a port forward to my website, making it transparent to someone accessing it?

One other idea I heard about was using mod rewrite from my current webhost to rewrite to my domain, but I'd also prefer not go this path. Besides that, do you know any .htaccess examples that actually work? I have tried this:

RewriteEngine on
RewriteRule ^/(.*) http://www.example.com:8080/$1

But it doesn't seem to be working.


Solution

  • What I'd like is for the costumer to type http://myaddress.com/hello/there?a=1&b=2 and it get translated to http://mylocalserver.com:8080/hello/there?a=1&b=2 and back again to the costumer on a transparent way.

    I believe this is the Apache RewriteRule you're looking for to redirect any URL:

    RewriteRule ^(.*)$ http://mylocalserver.com:8080$1 [R]
    

    From then on the customer will be browsing mylocalserver.com:8080 and that's what they'll see in the address bar. If what you mean by "and back again" is that they still think they're browsing myaddress.com, then what you're talking about is a rewriting proxy server.

    By this, I mean you would have to rewrite all URLs not only in HTTP headers but in your HTML content as well (i.e. do a regex search/replace on the HTML), and decode, rewrite and resend all GET, POST, PUT data, too. I once wrote such a proxy, and let me tell you it's not a trivial exercise, although the principle may seem simple.

    I would say, just be happy if you can get the redirect to work and let them browse mylocalserver.com:8080 from that point on.