Forum Discussion

Chenco_322726's avatar
Chenco_322726
Icon for Nimbostratus rankNimbostratus
Jun 01, 2017

HTTPS to HTTP when having another Irule for HTTP to HTTPS

Hello , im trying to redirect make a redirect on a specific page to work without the https. i've tried many of suggestions here/google and did not had luck yet . i do have another rule for that domain from http to https what im trying to do is to make another rule which will redirect the only specific page to http. can it be done? on which way?

 

Thank you.

 

2 Replies

  • Hello Chenco,

    Add this irule to your HTTP VS

    when HTTP_REQUEST {
    
        if { [string tolower [HTTP::path]] starts_with "/page1/" } {
            do nothing only log to verify that it works properly 
           log local0. "[HTTP::path]"
        } else {
          HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
        }
    
    }
    

    And add this irule to your HTTPs VS

    when HTTP_REQUEST {
    
        if { [string tolower [HTTP::path]] starts_with "/page1/" } {
             HTTP::redirect http://[getfield [HTTP::host] ":" 1][HTTP::uri]
        } else {
            do nothing only log to verify that it works properly 
           log local0. "[HTTP::path]"
        }
    
    }
    
  • Hello Chenco,

    You should modify your condition to

    if { ([string tolower [HTTP::path]] starts_with "/page1/") && ([string tolower [HTTP::host]] equals "www.example.com") }

    Regards