URL Switching / Stripping with aFleX and Switch
Posted by mischa
Code:
Code:
when HTTP_REQUEST {
HTTP::header insert X-Real-IP [IP::client_addr]
switch -glob [HTTP::uri] {
"/specific_url*" {
HTTP::respond 301 Location "http://[INSERT YOUR URL HERE]
}
"/images*" {
regsub -all "/images/?" [HTTP::uri] "/" newuri
HTTP::uri $newuri
pool pool_images
}
"/static/0*" {
regsub -all "/static/0/?" [HTTP::uri] "/" newuri
HTTP::uri $newuri
pool pool0
}
"/static/1*" {
regsub -all "/static/1/?" [HTTP::uri] "/" newuri
HTTP::uri $newuri
pool pool1
}
"/static/2*" {
regsub -all "/static/2/?" [HTTP::uri] "/" newuri
HTTP::uri $newuri
pool pool2
}
}
}
0