Forum Discussion
delvinadm_21686
Nimbostratus
Feb 18, 2009URL Rewrite without Redirect
Hi everybody,
I've got a big problem, which I can't resolv.
The client types in the adressbar:
www.somesiteA.com/AAA
and the Loadbalancer should rewrite to this:
www.somesiteB.com:4444/AAA
But the important thing is, a HTTP::rewrite is not possible.
The client should see www.somesiteA.com/AAA, the Loadbalancer should act as an reverse Proxy.
I want the same result, as I would use the ProxyPass module on an apache httpd.
It would be very nice, to get a solution for this!
Thank you very much so far.
- hoolio
Cirrostratus
Hi, - delvinadm_21686
Nimbostratus
Hi Aaron, - hoolio
Cirrostratus
Hi Simon, - Russell_E_Glaue
Nimbostratus
Can you just set up a pool, put "www.somesiteB.com:4444" in it, and then send the web user connection to that pool with an iRule?rule loadBalancingiRule { when HTTP_REQUEST { set http_host [string trim [getfield [HTTP::host] ":" 1]] set http_host [string tolower $http_host] if { $http_host equals "www.somesitea.com" } { pool somesiteB_pool return } else { HTTP::respond 404 content { Not Found Not Found } } } }
- lmwf1_55268
Nimbostratus
Try this and see if it works. - delvinadm_21686
Nimbostratus
Hi rglaue,Posted By rglaue on 02/18/2009 12:16 PM
rule loadBalancingiRule { when HTTP_REQUEST { set http_host [string trim [getfield [HTTP::host] ":" 1]] set http_host [string tolower $http_host] if { $http_host equals "www.somesitea.com" } { pool somesiteB_pool return } else { HTTP::respond 404 content { Not Found Not Found } } } }
- delvinadm_21686
Nimbostratus
Hi lmwfl,Posted By lmwf1 on 02/18/2009 3:18 PM
- hoolio
Cirrostratus
For details on the various HTTP:: commands you can check the iRule wiki page:when HTTP_REQUEST { Log a debug line on each request log local0. "[IP::client_addr]:[TCP::client_port]: New request to [HTTP::host][HTTP::uri]" Check if the host/path starts with the following string if {("[string tolower [HTTP::host]][HTTP::path]" starts_with "webservice.xxx.xx/webservice/")}{ Replace the host header HTTP::header replace Host "ihstestweb.xxx.xx:1234" Log a debug line on each Host rewrite log local0. "[IP::client_addr]:[TCP::client_port]: Rewrote Host header from [HTTP::host] to ihstestweb.xxx.xx:1234" } }
when HTTP_RESPONSE { Replace the internal hostname in the HTTP Location header value in redirects if {[HTTP::is_redirect]}{ log local0. "[IP::client_addr]:[TCP::client_port]: Rewriting redirect from [HTTP::header value Location] to\ [string map {ihstestweb.xxx.xx:1234 webservice.xxx.xx}] [HTTP::header value Location]]" HTTP::header value Location [string map {ihstestweb.xxx.xx:1234 webservice.xxx.xx}] [HTTP::header value Location]] } }
when HTTP_RESPONSE { Replace the internal hostname in the HTTP Location header value in redirects if {[HTTP::is_redirect] && [HTTP::header value "Location"] contains "ihstestweb.xxx.xx:1234/webservice"}{ log local0. "[IP::client_addr]:[TCP::client_port]: Rewriting redirect from [HTTP::header value Location] to\ [string map {ihstestweb.xxx.xx:1234 webservice.xxx.xx}] [HTTP::header value Location]]" HTTP::header value Location [string map {ihstestweb.xxx.xx:1234 webservice.xxx.xx}] [HTTP::header value Location]] } }
- Russell_E_Glaue
Nimbostratus
- lmwf1_55268
Nimbostratus
Try this.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects