Forum Discussion
redirect to https multiple uri's while letting others pass through
I have created a Virtual Server with port 80, created a pool and have added the iRule to the Virtual server. I have a wild card SSL cert that works for our appsf5.com
I have created the following iRule, but it only works once or twice before getting a page not found.
when HTTP_REQUEST
{ if { [HTTP::host] equals "appsf5.com" }{
if { [HTTP::uri] starts_with "/applications/app1" }
{ HTTP::redirect "https://[HTTP::host]/applications/app1/logon.aspx" }
elseif { [HTTP::uri] starts_with "/applications/app2" }
{ HTTP::redirect "https://[HTTP::host]/applications/app2/login.asp" }
elseif { [HTTP::uri] starts_with "/applications/app3" }
{ HTTP::redirect "https://[HTTP::host]/applications/app3/login.asp" }
elseif { [HTTP::uri] starts_with "/applications/app4" }
{ HTTP::redirect "https://[HTTP::host][HTTP::uri]" }
else {HTTP::respond "http://[HTTP::host][HTTP::uri]" }
}
}
56 Replies
- deni_22991
Nimbostratus
I am once again getting a page cannot be displayed.
But, at first it looked like it was working. Is there a time delay on the F5 after resyncing? It was actually redirecting from http to https for the gf82, and all the pages (both the http and https) were coming up correctly. But then I did a Ctrl F5 to refresh the page and all of them came up with a page cannot be displayed error message. - Chris_Miller
Altostratus
Good question on the delay. I've sometimes edited a rule and had nothing happen until I clicked Update on the Virtual Server...not sure what that was about.
Anywho, if you've edited the rule, try clicking Update on the Virtual and keep trying different links. it'd be nice to get some good logs. - Chris_Miller
Altostratus
I just tried the g82 link myself and it looks good? - deni_22991
Nimbostratus
Try this link. It is one of the links that should not go through the rule. http://appsf5.sd.gov/applications/HC70SBI/default.asp
It was working until adding the -glob command. But the redirected http to https links are now working. I'll hit the sites for awhile ( I have 8 that I'm testing, some http and some https) and I'll send the logs. - deni_22991
Nimbostratus
Fri Jan 7 12:56:59 CST 2011 tmm tmm[2048] Rule apps_withssl HTTP_REQUEST: User went to http://appsf5.sd.gov/applications/hc54contractoraccess/Logon.asp
Fri Jan 7 12:57:00 CST 2011 tmm tmm[2048] Rule apps_withssl HTTP_REQUEST: User went to http://appsf5.sd.gov/applications/hc54contractoraccess/Logon.asp
Fri Jan 7 12:57:00 CST 2011 tmm tmm[2048] Rule apps_withssl HTTP_REQUEST: User went to http://appsf5.sd.gov/applications/hc54contractoraccess/Logon.asp
Fri Jan 7 12:57:10 CST 2011 tmm tmm[2048] Rule apps_withssl HTTP_REQUEST: User went to http://appsf5.sd.gov/applications/gf82/login.asp
Fri Jan 7 12:57:10 CST 2011 tmm tmm[2048] Rule apps_withssl HTTP_REQUEST: Requested http://appsf5.sd.gov/applications/gf82/login.asp and was redirected to https://appsf5.sd.gov/applications/gf82/login.asp
Fri Jan 7 12:57:12 CST 2011 tmm tmm[2048] Rule apps_withssl HTTP_REQUEST: User went to http://appsf5.sd.gov/applications/HC70SBI/default.asp
Fri Jan 7 12:57:13 CST 2011 tmm tmm[2048] Rule apps_withssl HTTP_REQUEST: User went to http://appsf5.sd.gov/applications/HC70SBI/default.asp
Fri Jan 7 12:57:14 CST 2011 tmm tmm[2048] Rule apps_withssl HTTP_REQUEST: User went to http://appsf5.sd.gov/applications/HC70SBI/default.asp
Fri Jan 7 12:57:19 CST 2011 tmm tmm[2048] Rule apps_withssl HTTP_REQUEST: User went to http://appsf5.sd.gov/applications/st01fastfile/login.asp
Fri Jan 7 12:57:19 CST 2011 tmm tmm[2048] Rule apps_withssl HTTP_REQUEST: Requested http://appsf5.sd.gov/applications/st01fastfile/login.asp and was redirected to https://appsf5.sd.gov/applications/st01fastfile/login.asp
On the ones that should not be https (hc54 and hc70) I get page cannot be displayed. And I'm still getting it after doing the update of the Virtual Server and re-syncing. - Chris_Miller
Altostratus
The errors are 403s. IIS looks a bit mad.
The redirects are definitely working but IIS is throwing errors. Can you check IIS logs to see if it's having issues? - deni_22991
Nimbostratus
IIS is not throwing any errors for these. - Chris_Miller
Altostratus
I'm no longer getting a 403 for https://appsf5.sd.gov/applications/gf82/login.asp.
I am, however; getting a 403 for http://appsf5.sd.gov/applications/HC70SBI/default.asp.
The pool for your HTTP Virtual Server is the same for your HTTPS one, right? - deni_22991
Nimbostratus
The pool is the same for both the HTTP and HTTPS Virtual Server.
What does the -glob do?
I've made no changes to the F5 or the iRule and now my http sites are coming up and my https sites are giving me a page cannot be displayed error. - Chris_Miller
Altostratus
Posted By deni on 01/07/2011 12:31 PM
The pool is the same for both the HTTP and HTTPS Virtual Server.
What does the -glob do?
I've made no changes to the F5 or the iRule and now my http sites are coming up and my https sites are giving me a page cannot be displayed error.
It adds some capabilities.I'm very confused as to what's going on.
The error isn't a typical error...it's an IIS Access issue. I'd try again without -glob I guess. The redirect is happening, so not sure why the 403 is getting thrown. I'm not enough of an IIS guy to speak to that.
The page cannot be displayedYou have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.Please try the following:Contact the Web site administrator if you believe this directory should allow execute access.
HTTP Error 403.1 - Forbidden: Execute access is denied.Internet Information Services (IIS)Technical Information (for support personnel)Go to Microsoft Product Support Services and perform a title search for the words HTTP and 403.Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Configuring ISAPI Extensions, Configuring CGI Applications, Securing Your Site with Web Site Permissions, andAbout Custom Error Messages.In the IIS Software Development Kit (SDK) or at the MSDN Online Library, search for topics titled Developing ISAPI Extensions, ISAPI and CGI, and Debugging ISAPI Extensions and Filters
You could
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
