Forum Discussion
krelm_52303
Nimbostratus
Nov 20, 2008Changing HTTP Header Host port
Am receiving http requests on a high port (55555) and need to remove this in the header for all requests (so it sends on as port 80).
For example...
Host: www.google.com:...
krelm_52303
Nimbostratus
Nov 24, 2008Here's a version that is working for us (changing the Request Host header and URI), but hoping there's an easier way to modify the URI?
when HTTP_REQUEST {
Check if host value has a colon
if {[HTTP::host] contains ":"}{
log local0. "URI: [HTTP::uri]"
set find ":55555"
set replace ""
set uri_old [HTTP::uri]
regsub -all $find $uri_old $replace new_uri
HTTP::uri $new_uri
log local0. "NEW URI: [HTTP::uri]"
Replace host header value with everything before the colon
set new_host [getfield [HTTP::host] ":" 1]
HTTP::header replace "Host" $new_host
log local0. "[IP::client_addr]:[TCP::client_port]: Replace original host [HTTP::host] with [getfield [HTTP::host] ":" 1]"
}
}
Also, as you suggest, it looks like we'll need to modify the HTTP_Response Location header + any other references to objects in the HTTP_Response payload. May need to look at this...
http://devcentral.f5.com/weblogs/Joe/archive/2005/07/27/1398.aspx
Cheers.
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