Forum Discussion
Angelo_102265
Nimbostratus
Jul 23, 2009Http Rewrite to 1 domain
I need to create an irule that is listening on 1 VIP and changes all incoming requests to a single domain to the server pool.
www.cname1.com/images -> F5 VIP -> www.static.com/images -> pool of servers.
The incoming Domain can be anything but it will always need to be sent back to the webservers as www.static.com/images
would the following work
when HTTP_REQUEST {
set http_host HTTP::host
switch http_host {
{HTTP::redirect "http://www.static.com/"}
}
}
1 Reply
Sort By
- hoolio
Cirrostratus
Using HTTP::redirect will send a 302 redirect back to the client with the Location in the redirect set to whatever you put in quotes. If you want to rewrite the Host header, you can use HTTP::header replace Host "newhost.example.com":when HTTP_REQUEST { Rewrite host header HTTP::header replace Host "www.static.com" Rewrite URI? if {not ([HTTP::uri] starts_with "/images")}{ Prepend /images to the URI HTTP::uri "/images[HTTP::uri]" } }
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