Best way to rewrite HTTP/ HTTPS response to change URL?
We have a white-label application which doesn't support being hosted inside subdirectories, IE: The application can live at foo.com/ not foo.com/bar. We have a new business requirement for a client which requires that our application lives at foo.com/bar.
I think that the best way to get around this is with 2 iRules:
-
An iRule that rewrites requests to foo.com/bar/stuff to foo.com/stuff. This I have completed.
-
Another iRule which rewrites payloads rewriting any instance of foo.com/stuff to foo.com/bar/stuff.
The second iRule is where I'm having trouble, I see examples of doing payload rewrites but not with a regex style match, IE it seems very easy to rewrite foo.com/stuff1 to foo.com/bar/stuff but not for foo.com/* to foo.com/bar/* Ideally, I'd also like to be able to limit this iRule to only inspecting and modifying payloads when an HTTP_REQUEST matches an array of domains to reduce the overall load on F5 but I don't understand how to link a stream rewrite to an HTTP_REQUEST.
Any advice is greatly appreciated.