Forum Discussion
Modifying http uri response
Hi All, is there any iRules where I can modify the http uri response of the server going to client?
The scenario is this, every time the server respond to http request the server includes its hostname to uri.
Ex.
Now I want to show only to client side. Is this something to do with stream profile?
-Nat
- Jad_Tabbara__J1
Cirrostratus
Hello Nat,
Could you please determine which HTTP response header you want to modify ?
Is it in a header or in the body ?
Regards
- P_K
Altostratus
Did you try replacing the uri in the header under HTTP Response event?
- The_Bhattman
Nimbostratus
Hi
Take a look at this devcentral post. It might have the information you are looking for
https://devcentral.f5.com/questions/how-to-hide-uri-from-server-response-50710
I hope this helps
-=Bhattman=-
- Nath
Cirrostratus
@JT its on the header
- Nath
Cirrostratus
@PK Haven't tried it yet. What I've tried is modifying the http uri response using iRule
- Jad_Tabbara__J1
Cirrostratus
If it is in response headers, you don't need a stream profile for that.
So is it the "Location" header, when your server redirect clients ?
Thanks
- Jad_Tabbara__J1
Cirrostratus
Based on what I understand, you need to replace the "Location" response header.
In this case please try following irule without the need to add any "Stream" Profile.
when HTTP_RESPONSE { if { [HTTP::is_redirect] } { if { [HTTP::header Location] contains "/server1" } { log local0. "Location value before replace : [HTTP::header value Location]" HTTP::header replace Location [ string map -nocase { "/server1" "" } [HTTP::header value Location] ] log local0. "Location value after replace : [HTTP::header value Location]" } } }
You can check the /var/log/ltm to check if it is working well.
Also replace "/server1" by the name of your backend server.
Regards
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