Forum Discussion

MatoS's avatar
MatoS
Icon for Nimbostratus rankNimbostratus
Apr 13, 2022

HTTP redirect passing HTTP referer value

Hi,

I have a request from a customer which I cannot resolve by myself.

Customer wants to track http referers at their sharepoint site like this: When on site "xyz" and you click site "linkit" you will be redirected to "sharepoint" site and http referer value about "xyz" will be transfered to "sharepoint" site as well. We have set up Virtual Systems on F5 for both http and https "linkit" with iRule attached to redicrect to the "sharepoint" site.

iRule:

when HTTP_REQUEST {
HTTP::redirect "https://sharepoint.aspx"
}

Whit this "HTTP::redirect" appraoch the HTTP referer about "xyz" site is not transfered to "sharepoint" site.

Is it even poslible to transfere the HTTP referer with the redirect?

Thanks

6 Replies

  • Great! please don't forget you mark some thumbs up or select the response as "resolved" to let other people find it.

  • Hello MatoS.

    Have you tried with next iRule?

    when HTTP_REQUEST {
    	HTTP::respond 301 Location "https://sharepoint.aspx" Referer "https://[HTTP::host][HTTP::uri]"
    }

     

    • MatoS's avatar
      MatoS
      Icon for Nimbostratus rankNimbostratus

      Thanks for suggestion. I will have to try.

      • If a user has provided you with a solution to your post - please remember to click Accept as Solution - so others may find the solution easier in the future - you may mark more than one answer as Solution.

  • why on xyz site you can configure redirect link going to sharepoint site directly?  Referer header should come to F5 VIP for linkit. You can see by logging in the iRule if that comes and forward it using below iRule

     

     

    when HTTP_REQUEST {
    if {[HTTP::header exists Referer] }{
    log local0. "referer header found"
    set referer [HTTP::header value Referer]
    HTTP::respond 301 Location "https://sharepoint.aspx"
    HTTP::heder insert "Referer" $referer
    } else {
    log local0. "no referer header found"
    HTTP::respond 301 Location "https://sharepoint.aspx"
    #HTTP::heder insert "Referer" no-referer-found
    }
    }

     

  • Hi Matos,

    I would like to share iRules below, I hope this will help you, Please find more information in this link (https://cloud-ttrust.com/f5-irules-check-http-referrer-and-redirect-traffic/)

    when HTTP_REQUEST {
    if { [string tolower [HTTP::header value Referer]] contains "linkit" } {
    HTTP::redirect "https://sharepoint.aspx"
    } elseif { [string tolower [HTTP::header value Referer]] contains "xyz" } {
    HTTP::redirect "https://sharepoint.aspx"
    } else {
    pool pool1
    }

    }