Forum Discussion
vrn_159121
Altostratus
Sep 23, 2017how to handle internal server redirects 301 & 302 which redirect to another ports
Hi
below is my config
backend node is with port 80
and VS is 443 doing ssl offload
Problem
once i browse https://xyz.com my internal server gives a response 301 and redirects to another url
ie...
Jad_Tabbara__J1
Cirrostratus
Sep 23, 2017Hi VRN,
Could you try the following irule
when HTTP_REQUEST {
Remove the "Accept-Encoding" header
HTTP::header remove "Accept-Encoding"
Disable the stream filter for all requests
STREAM::disable
}
when HTTP_RESPONSE {
if {[HTTP::header exists Location] } {
log local0. "Old Location is: [HTTP::header Location]"
HTTP::header replace Location [string map {"xyz.com:4444" "xyz.com"} [HTTP::header Location]]
log local0. "New Location is: [HTTP::header Location]"
}
Check if response type is text
if { [HTTP::header value Content-Type] contains "text" || [HTTP::header value Content-Type] contains "xml" } {
Replace http with https, xyz.com:4444 with xyz.com
STREAM::expression [list {@http:\@https:\@} {@xyz.com:4444@xyz.com@} ]
Enable the stream filter for this response only
STREAM::enable
}
}
when STREAM_MATCHED {
Log each match found by the stream filter
log local0. "Stream filter matched: [STREAM::match]"
}
N.B: Add a stream profile and you can check the logs in /var/log/ltm normally if the rewrite works fine, it will logs each match found...
Waiting for you feedback
Regards
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