Forum Discussion
redirect to to 301 location
- Oct 18, 2022
My bad, there's a typo.
Edited in previous comment
Hello, I've notciced your URL is build with a reserved character "#" , you might want to review this because hash character is used as a delimiter to separate the URI from a fragment identifier, so everything after /#/ in your query will not be sent to the server unless JavaScript code running inside the browser. If client doesn't send it of course it will also not be matched by BIGIP HTTP profile so recalling it with [HTTP::uri] for an exact match comparison will fail.
Other than this, matching content is pretty simple, if you have an HTTP profile attached to your VS you can use [HTTP::query] or [HTTP::uri] to recall information from client request.
Depending on how many matches you have on ID, you can use if/switch/datagroups to build your syntax ; this is a sample with a switch statement
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/external/services/datastorage/" }{
set id [findstr [HTTP::query] "id=" 3 &]
switch -glob $id {
143 -
144 { HTTP::respond 301 Location "https://different-website.domain[HTTP::uri]" }
145 { log local0. "this is a different match" }
default {}
}
# in above switch statement , ?id=143 or ?=id 144 will match same condition ; ?id=145 will match its own condition ; every other ?id=xxx value will match default
}
}
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