Forum Discussion
Redirecting URI and Dynamic Content
I am struggling to get this to work. Here is the scenario:
https://mycompany.com/virtual.aspx?code=....&type=....
Redirect to:
https://egift.mycompany.com/egift.aspx?eid=.....&tid=.......
Any help would be appreciated
- DevBabuCirrus
what would be the value for eid and tid ?
- marv_Williams_5Nimbostratus
The only values that are the same are the eid and tid. everything else is dynamic
- marv_Williams_5Nimbostratus
Let me try this again: Client enters https://mycompany.com/virtual.aspx we want to redirect to: https://egift.mycompany.com/virtual.aspx?code=.......&type=......
When I try to redirect based on URI the dynamic portion is cutoff. I need to pass the entire URI and dynamic content also
- Kevin_StewartEmployee
How are you doing it now? If you're using HTTP::path to evaluate the URI, that will indeed ignore the query string portion of the URI.
- marv_Williams_5Nimbostratus
I was using HTTP path and the uri virtual.aspx to redirect
- marv_Williams_5Nimbostratus
Here is the I-Rule I initially came up with to redirect but it was chopping off the dynamic content
when HTTP_REQUEST { set uri [HTTP::uri] set host [HTTP::host] if { "$uri" contains "/egift" } { HTTP::redirect "https://egiftpp.mycompany.com/$uri" } }
- DevBabuCirrus
can this be done this way when HTTP_REQUEST { if { [string tolower [HTTP::host]] equals "mycompany.com" } { if {[HTTP::query] != ""} { HTTP::respond 302 Location "https://egiftpp.mycompany.com[HTTP::path]?[HTTP::query]" } else { HTTP::respond 302 Location "https://egiftpp.mycompany.com[HTTP::path]" } } }
- Stanislas_Piro2Cumulonimbus
Hi,
If I understand what you want in the first question:
- hostname is replaced from mycompany.com to egift.mycompany.com
- path must be replaced from /virtual.aspx to /egift.aspx
- parameter code is stripped
after some added information, you only change hostname... can you explain each part that must be changed.
- DevBabuCirrus
Will the value of eid and tid changes during redirection or remains same ?
for example.
Original Request https://123.mycompany.com/egift.aspx?eid=abc123&tid=def123 Is this Redirection: https://456.mycompany.com/egift.aspx?eid=abc123&tid=def123 or it has a different value https://456.mycompany.com/egift.aspx?eid=pqr123&tid=xyz123
- Opher_Shachar_6Nimbostratus
Can I make a suggestion?
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