Forum Discussion
iRule to redirect a URI to a different node and URI while masking the url to the user
Is it possible to have an iRule that will redirect a url www.xyz.com/a to a different node and path while masking the url to the client?
Example User goes to www.xyz.com/abc, but the ltm sends that request to a different node/URI outside of that pool while still maintaining the original URL?
So I guess it would need to see the http host which equals xyz.com and http:uri equals abc/ then redirect to a different node 1.1.1.1 and a uri abcabc/, then rewrite the header to maintain the original URL?
I have been looking at proxypass, just not sure if that is the correct solution.
I just don't know the syntax to put it into place.
6 Replies
When you say "then rewrite the header to maintain the original URL?" do you want to send the original URL to the destination server? Or are you simply saying that you don't want the client to know you messed with the headers?
If it is the latter, you can just rewrite the HTTP::host and HTTP:uri headers with the new information because the uri is not included in the http response. Something like this:
when HTTP_REQUEST { if { ([HTTP::host] equals "www.xyz.com") && ([HTTP::uri] equals "/a") } { HTTP::host "www.newhost.com" HTTP::uri "/your_new_uri" pool your_pool } }
Hope this helps.
Robert
As Robert said, all you need to do is to use the HTTP::uri command to change the URI that is being sent to the backend server. ProxyPass does this on a bigger scale but if you are just trying to do a single URI, then a simple iRule like Robert supplied would work fine.
- achapman_198069
Nimbostratus
I want to send the original URL back to the client(user).
- The URL on the client's address bar will not change because you are not issuing a redirect to the user. You are rewriting the URL and URI information and then sending it to the server. The URI and host headers are not included in the http response, so the end user will be unaware of the change.
- achapman_198069
Nimbostratus
Well thank you Robert. How's the bank?
- You're welcome. When I saw achapman, I was wondering if it was you. Give me a call sometime and we can catch up.
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