Forum Discussion
redirect to to 301 location
- Oct 18, 2022
My bad, there's a typo.
Edited in previous comment
Thanks for the response, could we make it such that anything after /datastorage/XXXX be extracted and appended to the new URL? So it does not have to be numeric values only (144,145 etc.
Example
/#/?id=144
https://different-website.domain/external/services/datastorage/#/?id=144
https://different-website.domain/external/services/datastorage/#/50b2580d-9f9f-41b7-b0af-618d570de14f/receipt
https://different-website.domain/external/services/datastorage/#/?vi=BYR&saksnr=12221&id=144
redirected to:
https://different-website.domain/external/services/datastorage/#/?id=144
https://different-website.domain/external/services/datastorage/#/50b2580d-9f9f-41b7-b0af-618d570de14f/receipt
https://different-website.domain/external/services/datastorage/#/?vi=BYR&saksnr=12221&id=144
So perhaps using "HTTP::query" & /path maybe
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/external/services/datastorage"
It didn't have to be numeric, script captured everything that followed "id=" so "id=abCD456" could be a match as well. I used numeric in my test because I assumed it was.
Code for scripting a wildcard match is much simpler, but once again I'm concerned that all of your URLs have a fragment identifier, which (being a client-only feature) I believe is not being sent by browser -- therefore parser will not see that part with [HTTP::uri] or [HTTP::query].
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/external/services/datastorage/" }{
HTTP::respond 301 Location "https://different-website.domain[HTTP::uri]"
}
}
- southern_shreddOct 18, 2022Cirrus
I got an error when trying to compile the irule
error: [command is not valid in the current scope][}]- CA_ValliOct 18, 2022MVP
My bad, there's a typo.
Edited in previous comment
- southern_shreddOct 19, 2022Cirrus
This worked great, thanks
Recent Discussions
Related Content
* 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