Forum Discussion
bdragna_8791
Nimbostratus
Feb 25, 2008HTTP Redirect/Rewrite iRule question
I'm kind of new to this, so I'm not even sure if what I'm trying to do is possible or if I'm going about it all wrong.
When the client's web browser makes a request to "host.domain.com" I want the browser to redirect to a different website called "domain.domainnew.com", but I want the client web browser to continue showing the original domain "host.domain.com" in the address bar.
I'm assuming this would require a redirect to "domain.domainnew.com" and then replace/rewrite the host header during the HTTP Response with the original domain "host.domain.com".
when HTTP_REQUEST {
set domain [getfield [HTTP::host] "." 2]
set host [HTTP::host]
set uri [HTTP::uri]
if { not ($domain equals "domainnew") } {
HTTP::redirect https://$domain.domainnew.com$uri }
}
when HTTP_RESPONSE {
HTTP::header replace Host "www.domain.org"
log local0. "Host header replaced: [HTTP::host]"
}
Any help would be appreciated.
I'm logging for HTTP Request and Response information and it looks like it's working from the log information, but the client web browser address bar does not continue to show the original domain.
- hoolio
Cirrostratus
If you send a redirect to the new domain, the client's browser will update when they make a request to the new domain. If you rewrite the Host header value and send it to the server in the pool, the BIG-IP will proxy the request and the change will be transparent to the client. - bdragna_8791
Nimbostratus
I've worked with the ProxyPass iRule a little bit and it's pretty slick, but a lot of it's over my head and I'm not sure if it addresses my particular issue. - Nicolas_Menant
Employee
Hi,
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