Forum Discussion
redirect with variable uri
- Jul 16, 2020
Hello VS.
Try this.
when HTTP_REQUEST { set uri_param [URI::query [HTTP::uri] uri] if { ([HTTP::host] contains "website1") and ([string tolower [HTTP::uri]] starts_with "/hptrimwebclient/download/") } { HTTP::redirect "http://website2.com/CS/HPRMServiceApi/Record/$uri_param/File/Document" } else { pool POOL1 } }
Regards,
Dario.
Hello VS.
You need to clarify better what you want to achieve.
Some example would be nice.
Regards,
Dario.
- VSJul 16, 2020Nimbostratus
Hi Dario!
I am trying to redirect :
http://website1/hptrimwebclient/download/?uri=123456&t=record&lang=ln_english&mbd=false
to:
http://website2.com/CS/HPRMServiceApi/Record/123456/File/Document
However 123456 above is a variable number and would need to be redirected to the corresponding URL with the same number. So that if the above example changes to:
http://website1/hptrimwebclient/download/?uri=987654&t=record&lang=ln_english&mbd=false
Then it would get redirected to:
http://website2.com/CS/HPRMServiceApi/Record/987654/File/Document
Thank you!
- Jul 16, 2020
Hello VS.
Try this.
when HTTP_REQUEST { set uri_param [URI::query [HTTP::uri] uri] if { ([HTTP::host] contains "website1") and ([string tolower [HTTP::uri]] starts_with "/hptrimwebclient/download/") } { HTTP::redirect "http://website2.com/CS/HPRMServiceApi/Record/$uri_param/File/Document" } else { pool POOL1 } }
Regards,
Dario.
- VSAug 05, 2020Nimbostratus
Hi Dario,
The above works great! Thanks so much for the help!
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