Forum Discussion
iaine
Jul 18, 2019Nacreous
So I'm guessing your application is using absolute paths when sending a redirect rather than relative paths? If so, you can either remedy this using the HTTP profile or in code. To add to the code that you've currently got, it would look something like this
when HTTP_REQUEST {
if {[HTTP::uri] equals "/"} {
HTTP::respond 404 content "<HTML><BODY>404 Page Not Found</BODY></HTML>" noserver
return
}
if {[HTTP::host] contains "example.com.au" } {
if {[HTTP::uri] starts_with "/abc/" } {
HTTP::uri [string range [HTTP::uri] 4 end]
}
HTTP::header replace Host "abc.com.au"
}
}
when HTTP_RESPONSE {
if { [HTTP::is_redirect] }{
HTTP::header replace Location [string map {"abc.com.au" "example.com.au"} [HTTP::header Location]]
}
}
There's good article here if you want to look at both options