Forum Discussion
Irule required for mentioned url
Hello,
Need an Irule for mentioned url -
When we call urls starting with http://uat-alfresco-euro.kamlesh.com:2095/alfresco/webdav it should call http://uat3.alfresco-euro.kamlesh.com:2095/alfresco/webdav
For example, if I try to reach in my browser http://uat-alfresco-euro.kamlesh.com:2095/alfresco/webdav/test/123 VIP should call http://uat3.alfresco-euro.kamlesh.com:2095/alfresco/webdav/test/123
Original URL should be kept and not be replaced
Note- In url there is - uat and uat3(after redirection) and
Original URL should be kept and not be replaced.
Kindly help for redirection of url Thanks in advance
Regards Kamlesh Y
3 Replies
Hi,
You can try an irule simmilar to below code :
when HTTP_REQUEST { if { [HTTP::host] contains "uat-alfresco-euro.kamlesh.com" } { HTTP::redirect http://[string map { "uat-alfresco-euro.kamlesh.com" "uat3.alfresco-euro.kamlesh.com" } [HTTP::host]][HTTP::uri] } }This is a simple redirect. Just saw that you need to rewrite the host header so Stefan's irule is correct. But you may need to rewrite the response body to make sure that uat3.alfresco-euro.kamlesh.com is not visible from external.
- Stefan_Klotz
Cumulonimbus
Hi Kamlesh,
if you want that the original URL in your browsers address bar shouldn't be changed, then we are talking about URI rewriting instead of HTTP redirect. So in your example you want to exchange the host-part of your URL/request. Please try this one:
when HTTP_REQUEST { Replace host header with the internal name HTTP::header replace Host uat3.alfresco-euro.kamlesh.com:2095 }Please also have a look on the ProxyPass Lite iRule in case you might need to rewrite something in responses from the server as well. Hope that helps.
Ciao Stefan 🙂
- Vijay_E
Cirrus
If you are trying to mask the domain name, try this:
when HTTP_REQUEST { if { [HTTP::host] contains "uat-alfresco-euro.kamlesh.com" } { HTTP::host [string map {"uat-alfresco-euro.kamlesh.com" "uat3.alfresco-euro.kamlesh.com"} [HTTP::host]] } when HTTP_RESPONSE { if { [HTTP::header values Location] contains "uat3-alfresco-euro.kamlesh.com" } { HTTP::header replace Location [string map {"uat3-alfresco-euro.kamlesh.com" "uat.alfresco-euro.kamlesh.com" [HTTP::header value Location]] } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com