Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm attempting to setup a reverse proxy using Apache on my local machine, I have the following in my httpd.conf:

ProxyPass /app
ProxyPassReverse /app

Everything works great and browsing to* works as expected. The problem arises when I browse to a url that performs a redirect to a resource at the same hostname but a different port. Initially I thought I could handle this situation as follows:

ProxyPass /app:81
ProxyPassReverse /app:81

But whilst this works, cookies don't appear to carry across the redirect. How would I get cookies to carry across the redirect? Also whilst the port is actually known in advance, is there a more robust method of handling this such that a redirect to any arbitrary port is handled correctly?

share|improve this question
up vote 0 down vote accepted

You can't have a port specification on ProxyPass /app:81 - instead, the port to listen on should be determined by the VirtualHost block that the ProxyPass resides in.

Create a second VirtualHost set to port 81, then place a ProxyPass /app inside of it to get the behavior you're looking for.

share|improve this answer

Well, you could kind of use "port" numbers in the path just don't use ":"'s.

ProxyPassReverse /app ht+p://
ProxyPassReverse /app81 ht+p://

Assuming your site is ht+p:// --> -->

I prefer using names of the applications on the backend. In fact, you may have many different application servers but want all web requests to look like they came from the same spot:

ProxyPassReverse /games ht+p://
ProxyPassReverse /finance ht+p://
ProxyPassReverse /movies ht+p:// --> --> -->

share|improve this answer

Cookies aren't necessarily shared across different port numbers. This is because of ill-defined browser behaviour, not your reverse proxy configuration.

I suggest you stick with port 80 (or 443) for the front-end and use different URL paths instead of different port numbers.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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