Forum Discussion
Assist in Redirecting External URL to Internal URL: Currently Its failing
Requirement:
When user hits External URL: retail-api-preview.jdadelivers.com, the requirement is to redirect it to ilrwesapp1.jdadelivers.com/retail
Trying the below Irule: but failing in redirecting.
when CLIENT_ACCEPTED { set default_pool [LB::server pool] }
when HTTP_REQUEST { set http_uri [string tolower [HTTP::uri]]}
if {$http_uri equals "/" } { HTTP::redirect "http://ilrwesapp1.jdadelivers.com/retail/" pool retail-api-preview-Pool
return }
Kindly assist:
Thanks and Regards Parveez
8 Replies
- Kevin_Stewart
Employee
An HTTP::redirect will issue a 302 message to the user and physically reroute them to another URL? The pool command reroutes an internal flow to another pool member. Having an HTTP redirect and pool in the same context doesn't work - they're contradictory. Is "http://ilrwesapp1.jdadelivers.com/retail/" externally accessible?
- Parveez_70209
Nimbostratus
http://ilrwesapp1.jdadelivers.com/retail/ is not published anywhere for now, client should access that VIP Created.
- Kevin_Stewart
Employee
Okay, so walk me through intended traffic flow. When a user connects to "http://retail-api-preview.jdadelivers.com/", do you want them to get redirected to another site/URL at "http://ilrwesapp1.jdadelivers.com/retail/", or simply select a specific pool member (retail-api-preview-Pool) and change the URI? What are you trying to accomplish?
- nitass
Employee
http://ilrwesapp1.jdadelivers.com/retail/ is not published anywhere for now, client should access that VIP Created.
i think what Kevin wants to know are:
1) is ilrwesapp1.jdadelivers.com/retail on the same virtual server of retail-api-preview.jdadelivers.com?
2) would you like to change browser url when redirection (i.e. to ilrwesapp1.jdadelivers.com/retail)?
- Parveez_70209
Nimbostratus
Hi,
For this:created a VIP, Named as: retail-api-preview.jdadelivers.com-HTTPS. associated HTTP Profile: retail-api-preview-HTTP(default http parameters), associated pool named: retail-api-preview-Pool.
When a user connects to "http://retail-api-preview.jdadelivers.com/" yes, that should redirect it to ilrwesapp1.jdadelivers.com/retail, referrring the pool.
Thanks and Regards Parveez
- Kevin_Stewart
Employee
Still not 100% clear. I'm going to make an assumption here, based both on the requirement to send to a specific pool and that the "ilrwesapp1.jdadelivers.com" URL is not published and accessible, that 1) this URL is internal, 2) you need to change the URI to "/retail" and send to a specific pool, and 3) quite possibly that you need to change the Host header. If that's true, then the following might accomplish that for you.
when HTTP_REQUEST { if { [HTTP::uri] equals "/" } { HTTP::redirect "http://[HTTP::host]/retail" } HTTP::header replace Host "ilrwesapp1.jdadelivers.com" }If the user accesses the VIP without a specific URI, they'll get redirected to "/retail". The pool assignment is made at the VIP configuration level, so no need to assign it here. The Host header is replaced in the request.
- Parveez_70209
Nimbostratus
I simply putted this: its working:
when HTTP_REQUEST { HTTP::redirect http://ilrwesapp1.jdadelivers.com/retail[HTTP::uri] }
query is with pool and redirect, how can we now edit it more
- Kevin_Stewart
Employee
If this is working:
when HTTP_REQUEST { HTTP::redirect http://ilrwesapp1.jdadelivers.com/retail[HTTP::uri] }Then "http://ilrwesapp1.jdadelivers.com" must be an externally-accessible site. Is it a VIP on your BIG-IP? Where does the user go when you issue this redirect?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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