Forum Discussion

f5noob29's avatar
f5noob29
Icon for Altocumulus rankAltocumulus
Jan 21, 2021

301 Redirect but Adding Original URL and Referrer

Old website will be decommissioned and we want users that would access the old site to be redirected but with the original URL be added and a referrer in the header. Can the original URL can be passed as either a HTTP GET parameter or as a HTTP header, but the referrer should stay “hidden” and be passed in a HTTP header?

 

We'd like F5 to put the original URL and the referrer into GET parameters.

 

For example, a user goes to OLD-APP and clicks on help button.

 

OLD-APP: http://old-app.com/URI/query

help link: http://old-app.com-help/URI/query

 

F5 intercepts and returns HTTP 301 with the following headers:

 

Location: https://NEW-APP.com/redirect/?url=http%3A%2F%2Fold-app.com-help%2FURI%2Fquery&referer=http%3A%2F%2Fold-app.com%2FURI%2Fquery

Cache-Control: no-cache, no-store, must-revalidate, max-age=0

 

If there is no Referrer header, then F5 can omit referrer or just use an empty value (i.e. referrer=).

 

We are trying to achieved this via an iRule, I've looked around and found some iRule that could potentially helped but I cant create a specific iRule for this requirements. I'd appreciate your help. TIA.