In my office, I've set up two servers on one Windows 7 machine (and our network is a Windows domain). One is Apache, running on port 80, and another is the built in trac server running on port 8080. I've got a DNS entry that redirects reviewboard.etc.etc to the apache server, but for the trac server it still expects the port to be specified. How can I make it so that trac.etc.etc redirects to machinename:8080?


The solution, in case someone stumbles upon this later. The following went inside the <virtualhost *:80> block in a file included from my httpd.conf:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^trac\.etc\.etc
RewriteRule (.*) http://localhost:8080$1 [P]
ProxyPassReverse / http://localhost:8080/

Edited again to include ProxyPassReverse, without which all URLs generated by the proxied server will break


I don't know what "trac" is but if its default port is 8080 then set a A record for your public IP and do a NAT and Firewall through. In the more likely case its a web app/server then you still set the A record but DNS is not port aware, users will have to enter the 8080 unless you setup a redirect through Apache using something like mod redirect. - Sam's idea

  • 1
    As he already has Apache handling incoming requests on port 80, I would suggest that he setup forwarding from Apache to TRAC, using mode rewrite or similar.
    – Sam Cogan
    Feb 23 '11 at 12:46
  • True I thought about including that ;edit time.
    – Jacob
    Feb 23 '11 at 12:49

You can always use mod_proxy to handle the redirection to another server/port seamlessly as a passthrough. The basic documentation for mod_proxy available on apache.org covers how to do this.

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.