Forum Discussion
Julian_Grunnell
Nimbostratus
Nov 01, 2008httpclass redirect query
Hi - hoping someone can help with a HTTP Class Profile I have that does a redirect on URI Path Lists.
I have 2 VS, one HTTP & one HTTPS. Any requests for http://domain/contact* are sent to the HTTPS site. This is done via an iRule and works fine.
With the HTTPS VS I have a httpclass profile that sends ALL requests to the HTTP site UNLESS it is for /contact*, so I only want the /contact* requests to be secure.
It's come to light that I also need to add /images* & /css* to this ignore list. So these pages can be served from either the HTTP or HTTPS VS. At present if you request https://domain/images/top.gif you get sent to the HTTP site but this file is used in the /contact* page and causes browsers to complain that the whole page is not secure.
In my httpclass the URI Paths is to "Match Only" "regex (?i)^(?!/contact).+$" - so if the request DOES NOT match /contact* then send to HTTP.
I thought I could just add the following to the URI Path List in the GUI but this does not work, no errors are generated in the ltm log when I do this but requests for files under /images* for example still get sent to the HTTP site even though I requested them via HTTPS?
regex "(?i)^(?!/images).+$"
regex "(?i)^(?!/css).+$"
Does anyone know how to get this to work, any help would be appreciated.
The bigip.conf for this profile is:
profile httpclass redirect_httpsclass {
defaults from httpclass
pool none
redirect "http://[HTTP::host][HTTP::uri]"
paths regex "(?i)^(?!/contact).+$"
}
Thanks - Julian.
3 Replies
- Julian_Grunnell
Nimbostratus
Actually this particular question should be in the Adv. Design / Config section but anyway.
But can this be done with an iRule? If this was a HTTP request then it would be easy with the use of a logical operator and OR statement used in a rule associated with the HTTP VS, but for the HTTPS VS what Event can you use?
Thanks - Julian. - hoolio
Cirrostratus
Hi Julian,
Here is a regex you can use to match any path which doesn't start with /contact, /images or /css:
^(?!/contact|/images|/css).+$
And with the case insensitive option enabled:
(?i)^(?!/contact|/images|/css).+$
I haven't tested this on a BIG-IP.
Aaron - Julian_Grunnell
Nimbostratus
Thanks Aaron - once again you save the day, the "|" worked a treat and now my page is working as expected.
Thanks - Julian.
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects