uri masking
2 TopicsAdvice to partial rename uri path
Hi there masters! I would like to ask for advice. Is there a possibility that after I redirect an URL I can partial rename the 1st two paths in the redirected URI path? So, for example: when client requested our main page... "https://companyA.com/" I will redirect this to a path of "https://companyA.com/room/desktop/r/Home".. Then, I will hide/or rename the 1st two paths and this will appear on client's browser as "https://companyA.com/bed/table/r/Home". /bed/table uri path are strings not location or directory. Would this be plausible? I really just want to change their strings. I tried to code it but only the redirect is successful except for the changing of the names of the two paths: When HTTP_REQUEST{ if {([HTTP::host] equals "companyA.com" and [HTTP::uri]equals "/")}{ HTTP::redirect "https://[HTTP::host]/room/desktop/r/Home" } } When HTTP_RESPONSE { if {[HTTP::header exists "Location"]}{ HTTP::header replace "Location" [string map {"/bed/table" "/room/desktop"} [HTTP::header "Location"]] } } Can you help me on this? Thanks! Regards, ZeigSolved100Views0likes8CommentsURI Masking
Problem this snippet solves: The code snippet was utilized to mask the URI so that the client is unaware of the actual URI that was processed by the server. This can provide security but the main use case was to mask the older application version from the outside world. How to use this snippet: Whenever a client makes a request to: https://devtest.domain.com/wdev/wweb.ll?wsession it will be altered like this: https://devtest.domain.com/wdev/wweb.ll?FoldSession before it is load balanced to the pool: POOL-DEV2 The response from the pool member will be checked and the URI will be replaced like this: /wdev/wweb.ll?FoldSession replaced with /wdev/wweb.ll?wsession The replacement is done so the client doesn't know the actual URI that is being processed by the server. The same principle can be applied to replace the domain name/host header value. Code : when HTTP_REQUEST { set HOST [string tolower [HTTP::host]] set URI [string tolower [HTTP::uri]] if { $HOST contains "devtest.domain.com" } { #Disable SSL SSL::disable serverside } if { $URI contains "/wdev/wweb.ll?wsession" } { HTTP::uri [string map {/wdev/wweb.ll?wsession /wdev/wweb.ll?FoldSession} [HTTP::uri]] pool POOL-DEV2 } } when HTTP_RESPONSE { if { [HTTP::header values Location] contains "/wdev/wweb.ll?FoldSession" } { HTTP::header replace Location [string map {/wdev/wweb.ll?FoldSession /wdev/wweb.ll?wsession} [HTTP::header value Location]] } } Tested this on version: 11.0577Views1like0Comments