3

So I have a problem - I have my main site on apache web server on debian on port 80; I develop a web server (in some C++ or C#) and it currently runs on port 6666. But some people are living under firewalls and can access only port 80. I wonder if it is possible via apache map all requests to say mysite.com:80/6666/url as if they were to mysite.com:6666/url, not map via redirection, but really make apache stream content from my site to user as if it were in some folder?

3

You could use a reverse proxy via mod_proxy. The Apache Httpd configuration would be along these lines:

    ProxyPass /6666/ http://localhost:6666/
    <Location /6666/>
            ProxyPassReverse /6666/
            Order deny,allow
            Allow from all
    </Location>
1

Here is a good answer on Ask Ubuntu

iptables -t nat -A PREROUTING -p tcp --dport 6666 -j REDIRECT --to-port 80

This assumes you're not routing traffic for an entire network through this box and that if you were there's no expectation that traffic destined for other hosts will be on that port

Update

In case you mess up your iptables, here is a great article on flushing the tables and getting back to normal :)

  • 1
    this seems like it would rout users to the entire port 80 - not emulate a folder under it... – myWallJSON Mar 22 '12 at 13:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.