Forum Discussion

Jnon's avatar
Jnon
Icon for Nimbostratus rankNimbostratus
Nov 30, 2017

Host Header rewrite and uri path modification

Could use some assistance on with modifying my host and uri string as follows:

 

myhost.com/path1/path2/path3/ needs to be rewritten after the ssl offload as: path1.myhost.com/path2/path3/

 

the paths could vary, I just want to remove the first path in the uri, and move it to the beginning of the host and remove it from the uri string, and leave the remaining uri string in place.

 

1 Reply

  • You might use something like:

    when HTTP_REQUEST {
        set qual1 [getfield [HTTP::uri] "/" 2]
        HTTP::host "$qual1.[HTTP::host]"
        HTTP::uri [substr [HTTP::uri] [expr ([string length $qual1] + 1)]]
    }