Forum Discussion
Dave_21507
Nimbostratus
Aug 14, 2008redirect uri to https
Hello,
We have a .NET application hosted in IIS that has a bunch of static links to image files in http://host/images/file.jpg . What I'm looking to do is redirect (or rewrite?) img links on the pages from http://host/images/file.jpg to https://host/images/file.jpg - the purpose is so that IE users don't get the warning that some items are secure and others not.
Here's what I have so far:
when HTTP_REQUEST {
if { ( [HTTP::uri] starts_with "/images" ) }{
HTTP::redirect https://[HTTP::host][HTTP::uri]}
}
Any ideas? It isn't working as planned.
I also tried this approach (to no avail):
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"*images/" {
HTTP::respond 301 Location "https://[getfield [HTTP::host] : 1][HTTP::uri]"
}
}
}
Am I going in the right direction or should I take the approach of rewriting img links?
Thanks!
- The_Bhattman
Nimbostratus
There is a stream profile that you can use to rewire links in static pages - Kirk_Bauer_1018
Nimbostratus
You need to rewrite the links in the page before they are requested by the browser (using the stream profile, as mentioned). If you wait until the objects are requested (as you were trying to do) it is too late to rewrite them to avoid the error. - Dave_21507
Nimbostratus
Okay great, thanks for the tips guys! I will see if I can create a Stream profile to handle it.
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