Forum Discussion
hooleylist
Nov 09, 2007Cirrostratus
The value for HTTP::uri is cached, so you won't see the update. If you log the value for $relativeUri, is it what you expect?
Also, I would expect that the web server(s) in the pool would be able to parse an absolute URI, so you could just replace https:// with http:// using string map, instead of using all of the URI:: and HTTP:: commands. Here's an example to log the pre- and post-change URIs:
Rule to modify absolute URI to relative URI
when HTTP_REQUEST {
set relativeUri "[URI::path [HTTP::uri]][URI::basename [HTTP::uri]][HTTP::query]"
log local0. "Original URI: [HTTP::uri], modified URI: $relativeUri"
HTTP::uri $relativeUri
}
And here's an example that just replaces the https: with http:, keeping the absolute URI:
Rule to modify absolute URI from HTTPS to HTTP
when HTTP_REQUEST {
Use string map to replace "https:" with "http:" in the URI
set modifiedUri [string map {https: http:} [HTTP::uri]]
log local0. "Original URI: [HTTP::uri], modified URI: $modifiedUri"
HTTP::uri $modifiedUri
}
Once you have it tested, you can remove the logging and variable:
Rule to modify absolute URI from HTTPS to HTTP
when HTTP_REQUEST {
Use string map to replace "https:" with "http:" in the URI
HTTP::uri [string map {https: http:} [HTTP::uri]]
}
Aaron