Forum Discussion
TMcGov_92811
Nimbostratus
Jan 31, 2014Replacing hostname in HTTP RESPONSE header using stream profile and/or Irule
We are trying to allow access from the internet into an internal webserver running on port 8010. The webserver is coded with its internal hostname (host15.mycompany.com:8010) which is only resolvable...
Kevin_Stewart
Employee
Feb 03, 2014A few additional things:
-
You definitely need an HTTP profile for this, as the HTTP header replace logic requires it, and you specifically only want to capture and replace HTTP traffic anyway (not anything below HTTP).
-
I would leave the request chunking option at Preserve.
-
Would users actually reference the URL with the included port (ie. https://public.mycompany.com:443 vs. https://public.mycompany.com)?
when HTTP_REQUEST { Disable the stream filter for requests STREAM::disable Remove this header to prevent server from compression response HTTP::header remove Accept-Encoding } when HTTP_RESPONSE { set internal_host "host15.mycompany.com:8010" set external_host "public.mycompany.com" Rewrite the Location header for redirects if { [HTTP::header exists Location] }{ HTTP::header replace Location [string map "$internal_host $external_host" [HTTP::header Location]] } Rewrite the response content using a stream profile if it is text if { [HTTP::header Content-Type] contains "text" } { Set the stream expression with the find/replace strings STREAM::expression "@$internal_host@$external_host@" Enable the stream filter STREAM::enable } }
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