Forum Discussion

David_M's avatar
David_M
Icon for Cirrostratus rankCirrostratus
Dec 10, 2019

IIS Server redirects the f5 redirect and we are on a LOOP!

I can see that the backend IIS server redirects the domain.com/the-uri-needed URI again to /the-uri-needed. 

 

The correct redirect should have been from domain.com/ to domain.com/the-uri-needed, but that's not the case. 

 

Hence when the f5 redirects what we get is the following loop scenario.

 

domain.com/ ---> IRULE ------> domain.com/the-uri-needed -----> IIS redirect -----> domain.com/the-uri-needed -----> IIS redirect again -----> domain.com/the-uri-needed -----> BREAKS THE SITE!

 

Chrome on its own handles this but with f5 this is not the case..

 

What can I do here?

 

UPDATE 11 DEC 2019:

 

I tried to simulate this on IIS but IIS doesn't support redirects from a /uri but only for the host, so I think there is also some problems with the application's own redirects here.

 

4 Replies

    • David_M's avatar
      David_M
      Icon for Cirrostratus rankCirrostratus

      I tried few things but it did not work ..one is to replace the link from the response but still nothing . .

      when HTTP_REQUEST {
       
          HTTP::header remove Accept-Encoding
          STREAM::disable
      }
      when HTTP_RESPONSE {
       
          if { [HTTP::header exists Location] } {
            	  HTTP::header replace Location [string map {"https://domain.com/the-uri-needed" "https://domain.com/"} [HTTP::header Location]]
      		 
      		  
          }
       
          if { [HTTP::header Content-Type] contains "text" } {
       
              STREAM::expression {@https://domain.com/the-uri-needed@https://domain.com/@}
       
          }
              STREAM::enable
      }

      This is one..

      And another one to do the normal redirect from hostname to hostname/uri.

      • I think, this iRule looking clean.

        Could each request match the redirect iRule?

        Example loop:

        when HTTP_REQUEST {
        	if { [HTTP::uri] starts_with "/" } {
        		HTTP::redirect "https://domain.com/the-uri-needed"
        	}
        }