Forum Discussion
Need Help for irule configuration to change Http Responses / uri
I have an interactive web application that using some services ports. F5 will be used as a proxy, But after doing configuration not all application function work fine. shortly, I think I need irule to make some changes to changing http responses header (uri) from :
http://web.test.com:2000/link/uri to https://web.test.com/link/uri
Thanks
3 Replies
Hi Bayuwindu,
I guess you're talking about the "Location" header that is used for 301/302/307 HTTP redirects, isn't it?
To change those values you could use an HTTP_RESPONSE iRule in combination with the [HTTP::header] and [string map] command to tweak the redirect to your internal server names.
The required code would look like this...
when HTTP_RESPONSE { if { [HTTP::header exist Location] } then { HTTP::header replace Location [string map { "http://web.test.com:2000" "https://web.test.com" } [HTTP::header value Location]] } }Cheers, Kai
- bayuwindu_24616
Nimbostratus
Hi Kai, Thanks for your responses, but it didn't work. After doing inspect elements in my browser, I found that link response is given by javascript. Still searching for the solution.
- Stanislas_Piro2
Cumulonimbus
Hi,
before searching if the reverse proxy is able to rewrite responses, did you search if your application have a configuration solution to define reverse proxy URL?
For example, tomcat support this configuration:
you can also configure tomcat to inspect X-forwarded-proto header and insert this header in HTTP request with irule.
Sharepoint support this with Alternate access mapping...
IBM web sphere support this with following parameters:
trusthostheaderport = true com.ibm.ws.webcontainer.extractHostHeaderPort = true httpsIndicatorHeader = X-Forwarded-ProtoSo first, look at the application documentation for reverse proxy options and add expected headers in requests to optimize F5 performances and limit rewrite issues.
For one customer, when enabling response rewriting in irules, Appliance's performance was divided by 10... a simple configuration on the application server allowed me to disable rewriting without additional CPU load on backend server.
rewriting must be used only if there is no other solution.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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