Tom- thanks a lot for such a nice explanation Thanks, Vicky On Oct 15, 2012, at 8:53 PM, Tom Evans <tevans.uk@xxxxxxxxxxxxxx> wrote: > On Sun, Oct 14, 2012 at 5:22 PM, vivek aggarwal > <vicky007aggarwal@xxxxxxxxxxx> wrote: >> Folks, >> >> I am not able to forward the request from apache to tomcat when i am using >> the following configuration for ProxyPass elements : >> >> <VirtualHost *:80> >> ServerName vicky.com >> ProxyPass / http://localhost:8080/kdah >> ProxyPassReverse / http://localhost:8080/kdah >> ErrorLog logs/vicky_error.log >> </VirtualHost> >> But its working when i am using the context root(any string value eg:- /kd >> ) as mentioned below >> >> >> <VirtualHost *:80> >> ServerName vicky.com >> ProxyPass /kd http://localhost:8080/kdah >> ProxyPassReverse /kd http://localhost:8080/kdah >> ErrorLog logs/vicky_error.log >> </VirtualHost> >> Please suggest why is it like that ?????? >> >> >> Vicky > > ProxyPass and ProxyPassReverse do string manipulation of the URL. This > is your non-working example: > > ProxyPass / http://localhost:8080/kdah > ProxyPassReverse / http://localhost:8080/kdah > > The first line says "Replace the string '/' with the string > 'http://localhost:8080/kdah' at the start of the URL". So, if the URL > is '/example/page", the replacement is > "http://localhost:8080/kdahexample/page" - does that look right? > > The second line says "In certain response headers, replace the string > 'http://localhost:8080/kdah' with the string '/' at the start of the > URL". So, if the URL is "http://localhost:8080/kdah/example", the > replacement is "//example" - does that look right? > > The reason they don't look right is that the URLs do not match up > correctly. If the URL on the left ends in a '/', so must the one on > the right, or the string manipulations will not work correctly. Eg: > > ProxyPass / http://localhost:8080/kdah > ProxyPassReverse / http://localhost:8080/kdah > > Neither of these two are right, because the URLs on the left end in a > '/' and the URLs on the right do not. The following should work > correctly. > > ProxyPass / http://localhost:8080/kdah/ > ProxyPassReverse / http://localhost:8080/kdah/ > > I wish some note about 'match the slashes' up could go in the > documentation, I follow this simple rule and never have any issues > setting up reverse proxies. > > Cheers > > Tom > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx > For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx