Forum Discussion

adrian_171483's avatar
Dec 10, 2014

http > https redirect adding a " / " at the end..

Hi all,

 

I have a slight issue on a irule redirect we are using..

 

when HTTP_REQUEST { HTTP::redirect "https://[getfield [HTTP::host] ":" 1]/myco/somesiteorother[HTTP::uri]" }

 

when the client comes back to the server on HTTPS, there is a "/" after /myco/somesiteorother/

 

we need /myco/somesiteorother

 

this is breaking the site..

 

does any one know how to get rid of the "/" ?

 

2 Replies

  • I assume the final / is in the original request URI [HTTP::uri]. You can prove this if you add a logging statement like this before the HTTP::redirect command: log local0. "Original URI: [HTTP::uri]"

    Something like this shouldn't be breaking your site anyway, sounds like poor code.

    If you really must remove the / you'll need to modify the URI before you do the redirect. Something like this should work;

     

    set newuri [string trimright [HTTP::uri] "/"]
    

     

    and modify your redirect like so;

     

    HTTP::redirect "https://[getfield [HTTP::host] ":" 1]/myco/somesiteorother${newuri}" 
    

     

  • Apparently [HTTP::uri] add the "/" onto the end of the URI remove this and it goes away on the re-direct..

     

    HTTP_REQUEST { HTTP::redirect "https://[getfield [HTTP::host] ":" 1]/myco/somesiteorother[HTTP::uri]" }