: How do I use URL redirection with reverse proxy? My requirement is to redirect the URL, which is running on port 80 with reverse proxy. I guess I would have to use URL redirection, reverse
My requirement is to redirect the URL, which is running on port 80 with reverse proxy. I guess I would have to use URL redirection, reverse proxy together.
There is already a web-domain active like : abcd.cdsw.intranet.example.com However, we would want to use reverse proxy to hid the diversions from the URL, but this URL runs with port 80 I guess.
As a result, I couldn't able to start httpd server in Redhat enterprise Linux 7 to introduce reverse proxy. Can someone help me with this?
Expected:
Actual URL : abcd.cdsw.intranet.example.com/login
Expected URL : http or example.com/cdsw
More posts by @Alves908
1 Comments
Sorted by latest first Latest Oldest Best
Under Apache, using the ProxyPassReverse directive will do what you want. It will take the redirect from the backend server and replace the backend host name with the front end name. From the documentation:
This directive lets Apache httpd adjust the URL in the Location, Content-Location and URI headers on HTTP redirect responses. This is essential when Apache httpd is used as a reverse proxy (or gateway) to avoid bypassing the reverse proxy because of HTTP redirects on the backend servers which stay behind the reverse proxy.
They also have an example of how it is typically used in conjunction with adjusting cookie paths:
ProxyPass "/mirror/foo/" "http://backend.example.com/"
ProxyPassReverse "/mirror/foo/" "http://backend.example.com/"
ProxyPassReverseCookieDomain "backend.example.com" "public.example.com"
ProxyPassReverseCookiePath "/" "/mirror/foo/"
You may find that there are also absolute links in the HTML documents from the backend server. If that is the case, you can use the mod_proxy_html module to also replace those.
It sounds like that in this case you didn't develop the backend webapp yourself and it may not have settings for running behind a proxy server. However, if you can modify the code on the backend webapp, you can modify it to write its links and redirects using the front end host name.
The front end proxy server passes the host name to the backend using the X-Forwarded-For header. You can change your server to use the value from this header rather than ServerName so that it works seamlessly behind a proxy.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.