ankush grover
2008-Jul-06 10:24 UTC
[CentOS] How to Auto Add forward slash "/" when accessing a link/url through ProxyPass
Hi Friends, I am using Centos 5.2 and using ProxyPass to access applications running on other servers. Everything is working fine except for one of the applications I need to auto add forward slash when any user tries to access that application. For ex ProxyPass /testdiary testdiary.example.com ProxyPassReverse /testdiary testdiary.example.com If somebody access directly testdiary.example.com everything is coming means the login page but when the same link is accessed through apache server on which proxypass is running then the login page does not appear(portal.example.com/testdiary). How can I auto add "/" when somebody put the url portal.example.com/testdiary which should first be converted/redirected to portal.example.com/testdiary (auto added forward slash). I have the below lines added in httpd.conf file RewriteEngine On RewriteCond %{REQUEST_URI} /testdiary RewriteRule /testdiary(.)$ /testdiary/ ProxyPass /testdiary testdiary.example.com ProxyPassReverse /testdiary testdiary.example.com Please let me know if you need any other information. Regards Ankush
Filipe Brandenburger
2008-Jul-06 14:48 UTC
[CentOS] How to Auto Add forward slash "/" when accessing a link/url through ProxyPass
Hi, It's been long since I don't write Proxy rules, but IIRC you have to match /s on the left side and on the right side. On Sun, Jul 6, 2008 at 6:24 AM, ankush grover <ankushcentos at gmail.com> wrote:> ProxyPass /testdiary testdiary.example.com > ProxyPassReverse /testdiary testdiary.example.comMaybe try: ProxyPass /testdiary testdiary.example.com ProxyPassReverse /testdiary testdiary.example.com Or: ProxyPass /testdiary/ testdiary.example.com ProxyPassReverse /testdiary/ testdiary.example.com I guess the second one is the one you want, but it won't do the Redirect if you access /testdiary without the ending slash. You don't need mod_rewrite for that one, a simple RedirectMatch should be enough (I'm not 100% sure about the syntax though): RedirectMatch /testdiary$ /testdiary/ Please let us know how that goes for you. HTH, Filipe
nate
2008-Jul-06 14:51 UTC
[CentOS] How to Auto Add forward slash "/" when accessing a link/url through ProxyPass
ankush grover wrote:> I have the below lines added in httpd.conf file > > RewriteEngine On > RewriteCond %{REQUEST_URI} /testdiary > RewriteRule /testdiary(.)$ /testdiary/ > ProxyPass /testdiary testdiary.example.com > ProxyPassReverse /testdiary testdiary.example.comThis is what I do on my systems RedirectMatch /testdiary$ mysite.example.com/testdiary nate