I need to do a http.changeSite to a new url, but I need to reset the path to "/".
I match the current path and site in the traffic script
if ( ($host = "test.com/" ) &&
($path == "/apps" ) ) {
http.changeSite( "https://test2.com/" );
}
However I end up on "https://test2.com/apps", how do I reset the path to "/" on a redirect?
Thanks
Paul
You might try http.redirect( "https://test2.com/" ); which sends a HTTP 302 temporary redirect response, and can give you control over the exact destination URL?
There is a short article here on changeSite() here, but it does not give much detail on redirect():
https://community.pulsesecure.net/t5/Pulse-Secure-vADC/HowTo-Redirect-HTTP-clients/ta-p/33130
For other readers who are not familar with the power of TrafficScript, the latest reference guide is here:
I also tried http.redirect( "https://test2.com/" ); but still ended up with the /apps path.
It may also help to write some debug info to the log file to see what is going on:
$host = ...
$path = ...
log.info( "$Host=" . $host . " $Path=" . $path );
Given the redirect/change site actually happens, I would say that the values for $path and $host match exactly what is in the if statement - no need to log them.
I need a way to reset the redirected path. I have tried adding this to the code within the if statement before the call to http.changeSite or http.redirect, but still goes to /apps on the redirected site.
http.setPath( "/" );
Looks like something was caching on my firefox, tried firefox and chrome on another desktop and it's working fine.
Thanks for you help
Paul
ok great - can you confirm the final version of the script you are using? We can mark as a solution!