Forum Discussion

Tom_Butler_1775's avatar
Tom_Butler_1775
Icon for Altocumulus rankAltocumulus
May 12, 2016

How do i append to a url

I have an application that I am load balancing on my LTM

 

Currently in production the application has a windows based ssl load balancing server.

 

When a user accesses the service www.xxx.yyy.zzz they are redirected to https://www.xxx.yyy.zzz/directory/file

 

I have established the SSL redirection effectively, so the http to https to translation is working. What I need to determine is how to append the /directory/file to the url

 

There are applications on this web server that need to be able resolve http://www.xxx.yyy.zzz/activity on port 80 without being redirected to https, so I will need to exclude certain url's from the http to https redirection.

 

I am a brand new to this kind of work and would appreciate any assistance you can provide.

 

  • There are many ways of achieving it. The optimal solution will vary, depending on how many URLs (actually HTTP paths) you need to exclude from the HTTP to HTTPS redirection.

    • If there's 1-3 exclusions, I would use IF/ELSEIF conditional statements
    • If there are more than 3 exclusions, I would use SWITCH conditional statement
    • If there are more than 25 exclusions, I would use IF conditional statement to compare against a list of entries in a data-group.

    I'm aware of one exclusion, and I would use the following solution

    when HTTP_REQUEST {
    
      if { ([string tolower [HTTP::host]] eq "www.xxx.yyy.zzz") && not([string tolower [HTTP::path]] eq "/activity") }{
        HTTP::respond 301 Location "https://www.xxx.yyy.zzz/directory/file" Connection Close
      }
    
    }
    
  • There are many ways of achieving it. The optimal solution will vary, depending on how many URLs (actually HTTP paths) you need to exclude from the HTTP to HTTPS redirection.

    • If there's 1-3 exclusions, I would use IF/ELSEIF conditional statements
    • If there are more than 3 exclusions, I would use SWITCH conditional statement
    • If there are more than 25 exclusions, I would use IF conditional statement to compare against a list of entries in a data-group.

    I'm aware of one exclusion, and I would use the following solution

    when HTTP_REQUEST {
    
      if { ([string tolower [HTTP::host]] eq "www.xxx.yyy.zzz") && not([string tolower [HTTP::path]] eq "/activity") }{
        HTTP::respond 301 Location "https://www.xxx.yyy.zzz/directory/file" Connection Close
      }
    
    }
    
    • Hannes_Rapp_162's avatar
      Hannes_Rapp_162
      Icon for Nacreous rankNacreous
      The following part between quote marks can be removed if 'www.xxx.yyy.zzz' is the only Host served via this Virtual Server. ''([string tolower [HTTP::host]] eq "www.xxx.yyy.zzz") && ''
  • There are many ways of achieving it. The optimal solution will vary, depending on how many URLs (actually HTTP paths) you need to exclude from the HTTP to HTTPS redirection.

    • If there's 1-3 exclusions, I would use IF/ELSEIF conditional statements
    • If there are more than 3 exclusions, I would use SWITCH conditional statement
    • If there are more than 25 exclusions, I would use IF conditional statement to compare against a list of entries in a data-group.

    I'm aware of one exclusion, and I would use the following solution

    when HTTP_REQUEST {
    
      if { ([string tolower [HTTP::host]] eq "www.xxx.yyy.zzz") && not([string tolower [HTTP::path]] eq "/activity") }{
        HTTP::respond 301 Location "https://www.xxx.yyy.zzz/directory/file" Connection Close
      }
    
    }
    
    • Hannes_Rapp's avatar
      Hannes_Rapp
      Icon for Nimbostratus rankNimbostratus
      The following part between quote marks can be removed if 'www.xxx.yyy.zzz' is the only Host served via this Virtual Server. ''([string tolower [HTTP::host]] eq "www.xxx.yyy.zzz") && ''
  • Hi Hannes,

    I think

    ([string tolower [HTTP::path]] eq "/activity")
    may be replaced by
    ([string tolower [HTTP::path]] starts_with "/activity")

    And if Application is case sensitive, you can remove

    string tolower
    action.