Forum Discussion
Stanislas_Piro2
Nov 01, 2017Cumulonimbus
this code manage absolute to relative URL conversion
when HTTP_REQUEST {
STREAM::disable
HTTP::header remove "Accept-Encoding"
switch [string tolower [HTTP::host]] {
"test1.com" -
"test2.com" -
"test3.com" {
HTTP::redirect https://www.[HTTP::host][HTTP::uri]
}
"www.test1.com" {
pool test1
set stream_expresion "@http://www.test1.com/@/@ @http://www.test3.com/@https://www.test3.com/@ @http://www.test2.com/@https://www.test2.com/@"
}
"www.test2.com" {
pool test2
set stream_expresion "@http://www.test1.com/@https://www.test1.com/@ @http://www.test3.com/@https://www.test3.com/@ @http://www.test2.com/@/@"
}
"www.test3.com" {
pool test3
set stream_expresion "@http://www.test1.com/@https://www.test1.com/@ @http://www.test3.com/@/@ @http://www.test2.com/@https://www.test2.com/@"
}
default {log local0. "No match found for [HTTP::uri]"}
}
}
when HTTP_RESPONSE {
if {[HTTP::header value Content-Type] starts_with "text"} {
STREAM::expression $stream_expression
STREAM::enable
}
}