Forum Discussion
ProxyPass 302 redirect possible?
Hello, I just implemented the ProxyPass irule for some headerrewrites and it's working beautifully. The only thing is my customer wants me to also do a redirect if the URL matches a certain string.
This part works: /oldurl?useringormation1234456 is to be rewritten to /newurl?useringormation1234456 while leaving /oldurl?useringormation1234456 in the browser.
This part does not work: /oldurl/ is to be redirected to somename.elsewhere.com. I've tried using several methods in my data group but it does not seem to be working. I even created a pool with the somename.elsewhere.com:80 as a member and tried sending it there and also created a virtual server that does nothing but redirect to somename.elsewhere.com and nothing is working.
Does anyone have any suggestions on how to make proxypass do a good old fashioned 302 redirect?
Thanks!
Proxypass does not include redirect functionality that you can use for this. It only modifies traffic on the way to the server.
Your better off adding an iRule to do it.
when HTTP_REQUEST { if {[class search myclass equals "[HTTP::host][HTTP::uri]"]} { HTTP::redirect [class search -value myclass equals "[HTTP::host][HTTP::uri]"] } }
Then class myclass should contain text of the form...
Key Value old.host.com/url http://new.host.com/newurl old.host.com/url http://new.host.com/ old.host.com/url /mynewurl
- Kevin_Davies_40NacreousPlease can you paste the iRule you are working on. Make it a bit easier. When you paste, make sure you select the iRule and press Tab before you submit. This makes it a code block and provides syntax highlighting.
- Wendi_Goulette_NimbostratusIt's the standard proxypass irule. No modifications except I've got logging enabled. https://devcentral.f5.com/s/articles/proxypass-v10-v11
- Kevin_Davies_40Nacreous
Proxypass does not include redirect functionality that you can use for this. It only modifies traffic on the way to the server.
Your better off adding an iRule to do it.
when HTTP_REQUEST { if {[class search myclass equals "[HTTP::host][HTTP::uri]"]} { HTTP::redirect [class search -value myclass equals "[HTTP::host][HTTP::uri]"] } }
Then class myclass should contain text of the form...
Key Value old.host.com/url http://new.host.com/newurl old.host.com/url http://new.host.com/ old.host.com/url /mynewurl
- Wendi_Goulette_NimbostratusThanks for your response!
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