Forum Discussion
f5noob29
Jan 21, 2021Altocumulus
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 passe...
f5noob29
Altocumulus
Thanks Kees.
I got it to work but app owner says that they are seeing below,
Location: https://https://NEW-APP.com/redirect?url=http://old-app.com-help/URI/URI1/URI2/URI3
Instead of this,
Location: https://NEW-APP.com/redirect/?url=http%3A%2F%2Fold-app.com%2FURI%2FURI1%2FURI2%2FURI3
They also want to have a cache-control header
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Also the referrer does not seem to work as F5 doesn't include the referrer in the redirect URL.
TIA.
Jan 28, 2021
Hi,
Can you test this irule?
when HTTP_REQUEST {
set uri [URI::encode [HTTP::uri]]
set host [URI::encode [HTTP::host]]
set referer [URI::encode [ HTTP::header Referer ]]
if { [string tolower [HTTP::uri]] starts_with "/uri/"} {
HTTP::respond 301 Location "https://NEW-APP.com/redirect/?url=http://$host$uri\_\_referrer=$referer\&[HTTP::query]" Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
}
}
Cheers,
Kees
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects