Forum Discussion
Rusty_M_140798
Nimbostratus
Apr 20, 2017Change URL host without chaining in the User browser
I have request to publish one of our internal applications that is on a .local domain to be public facing on a .com domain. The team is not willing to change the URL and internal users use the .local...
Michael_Jenkins
Cirrostratus
Apr 27, 2017Sounds like you may want to look at using a stream profile to perform some custom rewriting on the response since the application requires the .local address, as well as changing the
Host header on the request as it comes through.
This may help...
Example which replaces xyz.local with xyz.com in response content
Prevents server compression in responses
when HTTP_REQUEST {
Change the Host header to the internal value
HTTP::host "xyz.local"
Disable the stream until we're ready
STREAM::disable
You always need to make sure the response content is uncompressed, so the data can be properly modified
HTTP::header remove "Accept-Encoding"
}
when HTTP_RESPONSE {
Typically you may only want to rewrite certain content types (like text or html)
if {[HTTP::header value Content-Type] contains "text"}{
Replace the values for xyz.local with xyz.com
STREAM::expression {@xyz.local@xyz.com@}
You may consider using this instead for multiple rewrites (or ensuring a url reference
STREAM::expression {@://xyz.local@://xyz.com@ @://www.xyz.local@://www.xyz.com@ @}
Enable the stream for this response
STREAM::enable
}
}
Hope this helps.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
