I have an apache2 running and i have a service available as http://www.domain.com:8080/sitename

What will be a simplest apache2 configuration so entering "http://www.domain.com" in browser will show "http://www.domain.com:8080/sitename"? I have added:

<VirtualHost *:80>
  ProxyPass / http://www.domain.com:8080/sitename/
  ProxyPassReverse / http://www.domain.com:8080/sitename/
</VirtualHost>

But, of course, this is not workig. Is it some simple configuration i can use for such redirect or i'm doomed to copy-paste a 100+ line configs from tutorials?

link|improve this question

feedback

4 Answers

up vote 2 down vote accepted

I think you are almost there try adding

ProxyRequests Off
<Proxy *>
    Order deny,allow
    allow from all
 </Proxy>
 ProxyPreserveHost On

to your VirtualHost definition

link|improve this answer
1) Default: ProxyRequests Off 2)your answer is no different from my – alvosu Jan 30 '11 at 15:06
@alvosu: 1. Better to be safe than sorry with some things. 2. That happens a lot here - you'll get used to it. – Iain Jan 30 '11 at 15:23
feedback

My working config(ubuntu 10.04):

<VirtualHost *:80>
  ProxyPass / http://www.domain.com:8080/sitename/
  ProxyPassReverse / http://www.domain.com:8080/sitename/
  ProxyPreserveHost On

  <proxy>
    Order deny,allow
    Allow from all
  </proxy>

</VirtualHost>
link|improve this answer
Thanks. Using this and adding mod_proxy_http solves the problem – Eye of Hell Jan 30 '11 at 15:11
feedback

That looks good. Check your error log. Do you have both mod_proxy and mod_proxy_http loaded? You should also have "ProxyRequests Off" to prevent you from becoming a forward proxy

link|improve this answer
Default: ProxyRequests Off – alvosu Jan 30 '11 at 15:07
feedback

The <proxy> statement is for a 'forward' proxy, which allows requests for any url on the web.

Loading mod_proxy_http and using 'ProxyPass' and 'ProxyPassReverse' statements will do what you want.

Apache 2.2 mod_proxy documentation for more.

(yes this is a bit of a duplicate answer, but I'm trying to make things clearer and hoping nobody inadvertently starts an open proxy)

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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