Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use relative path in ProxyPass/ProxyPassReverse?

For example there is following configuration in httpd.conf:

ProxyPass app   http://somehost:someport/App_1   
ProxyPassReverse app   http://somehost:someport/App_1   

Now I should use absolute urls to forward requests from "/myapp" to "/app":

<Location /myapp >   
   ProxyPass http://localhost:8080/app
   ProxyPassReverse http://localhost:8080/app
</Location>

Is it possible to use relative path in ProxyPass/ProxyPassReverse?

<Location /myapp >  
   ProxyPass /app  
   ProxyPassReverse /app  
</Location>  
like image 618
Volodymyr Bezuglyy Avatar asked Jan 13 '12 15:01

Volodymyr Bezuglyy


1 Answers

No.

The apache docs about ProxyPass says the target must be a URL. If you try to put something that isn't a URL (like /app), you get the following error:

ProxyPass URL must be absolute!

You should look into mod_rewrite instead. It can rewrite requests on the serverside without redirecting the browser. Giving your /myapp -> /app example, some simple rules such as this would suffice:

RewriteRule ^/myapp /app [L]
like image 100
Jon Lin Avatar answered Nov 16 '22 19:11

Jon Lin