Forum Discussion

adrian_171483's avatar
Mar 11, 2015

https matching

Hi,

 

I have an issue where we are re-directing http > https and adding some extra lines to a URI on the port re-direct.

 

When we target the Virtual server directly on HTTPS the re-direct is missed, and we just see the Admin page.. so ther serverside is not capible of the re-direct without the extended URI.

 

I need a solution in the HTTPS virtual server to match the Hostnames and ensure that they have the extra URI string to hit the web server directly.

 

so https://mysite.com/something/something

 

thanks

 

19 Replies

  • i think you do not need /something/something/* pattern because it will match default pattern anyway.

    when HTTP_REQUEST { 
      switch -- [string tolower [HTTP::uri]] { 
        "/" { 
          HTTP::redirect "https://[getfield [HTTP::host] ":" 1]/something/something"
          return 
        } 
        default { 
          pool mysite-pool
        } 
      } 
    }
    
  • Just a quick one.

     

    if I use this, when I come in with something/something already in the URI I presume it wont match and ignore the Irule

     

    when HTTP_REQUEST { if { [HTTP::uri] equals "/" } { HTTP::redirect "https://[HTTP::host]/something" } }

     

    • nitass's avatar
      nitass
      Icon for Employee rankEmployee
      yes, it doesn't match if expression (because uri is not equal to /) and, of course, body (HTTP::redirect) won't be executed.
    • nitass's avatar
      nitass
      Icon for Employee rankEmployee
      can you do some debugging? https://devcentral.f5.com/s/articles/getting-started-with-irules-logging-comments-20406
  • I would use this as an irule for a https server:

    when HTTP_REQUEST {
    if { [string tolower [HTTP::uri]] equals "/" } {
        HTTP::redirect https://[getfield [HTTP::host] ":" 1]/something/something
        }
    
  • ok so its working for some browers not for Mozilla ??

     

    really dont know why.. its very strange.. any ideas why Firefox would ignore the rule..??

     

    when HTTP_REQUEST { if { [HTTP::uri] equals "/" } { HTTP::redirect "https://[HTTP::host]/something/something" } }