Forum Discussion
Need help with iRule
Hello,We have an existing application https://abc.com which is configured with F5.When we open the page and click on status tab it will route to https://abc.com/api-status. Now the users want to see contents of https://abc.com/api-status in a new URL https://xyz.com.Is this achievable?If so can you please share the iRule for this.Appreciate your help.
gopalp I believe this is would be something that has to be tracked server side. You can perform a redirect after someone goes to https://abc.com/api-status to https://xyz.com but because this is most likely going to be a new session to a new FQDN the F5 isn't going to know how to interpret this and provide content to the user. You should be able to provide some sort of transaction ID, cookie, or referer that allows the xyz.com site to know that the user is looking for the contents of the output from abc.com/api-status.
- gopalpNimbostratus
Thank you for the update.Can you please share a sample iRule to achieve above usecase.
gopalp To perform the simple redirect it would be the following but if you did it on the F5 you would never receive the unique HTTP header from the server to carry over the users session after they went to the path you are referring to.
when HTTP_REQUEST priority 500 { if {[HTTP::host] == "abc.com"} { if {[HTTP::uri] == "/api-status"} { HTTP::redirect "https://xyz.com/" } } }
- JRahmAdmin
if you control both the abc.com and xyz.com domains, you can do this by hosting both abc.com and xyz.com in your SNI list on the the client-ssl profile of the single virtual (or...use a different virtual and keep the client-ssl profiles separate). And the iRule that Paulius shared would be on the shared virtual or only on the abc.com virtual. I'd tweak the iRule slightly but it's fine the way it is.
when HTTP_REQUEST priority 500 { if {([HTTP::host] == "abc.com") && ([string tolower [HTTP::uri]] == "/api-status")} { HTTP::redirect "https://xyz.com/" } }
gopalp - If your post was solved it would be helpful to the community to select *Accept As Solution*.
This helps future readers find answers more quickly and confirms the efforts of those who helped.
Thanks for being part of our community.
Lief
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