Forum Discussion

DaveC_53879's avatar
DaveC_53879
Icon for Nimbostratus rankNimbostratus
Jul 29, 2011

Inserting 301 returns blank page

The rule below returns a 301 but it also returns a blank page, so somehow my redirect to "http://synergycitizens.org[HTTP::uri]" isn't working. The host names below are not real, but the rule below accurately reflects my existing rule. What am I missing here? Thanks.

 

 

when HTTP_REQUEST {

 

switch -glob [string tolower [HTTP::host]] {

 

"www." -

 

"synergycitizens.net" -

 

"synergycitizens.com" -

 

"synergycitizens.mobi" -

 

"synergycitizens.net" -

 

"citizensforsynergy.org" -

 

"citizensforsynergy.net" -

 

"citizensforsynergy.com" -

 

"synergyscitizen.org" -

 

"synergyscitizen.com" -

 

"synergycitizen.net" -

 

"synergycitizen.com" -

 

"synergy-citizen.org" -

 

"synergy-citizen.net" -

 

"synergy-citizen.com" -

 

"synergy-citizens.org" -

 

"synergy-citizens.net" -

 

"synergy-citizens.com" -

 

"synergycitizen.org" { HTTP::respond 301 "http://synergycitizens.org[HTTP::uri]" }

 

}

 

}

 

  • Looks to me like your 301 response is missing a very important header...

     

     

    Example from my testing...

     

     

    HTTP/1.0 301 Moved Permanently

     

    Location: http://www.test.com/index.html

     

    Server: BigIP

     

    Connection: Keep-Alive

     

    Content-Length: 0

     

     

  • Aaron and Peter, I found the problem. I inserted the word "Location" after the 301. That works. Thanks for all your help. I really apreciate it. I wouldn't have gotten this far without it.

     

     

    when HTTP_REQUEST {

     

    switch -glob [string tolower [HTTP::host]] {

     

    "www.*" {

     

    HTTP::respond 301 Location "http://ddcpoc.com[HTTP::uri]"

     

    log local0. "[IP::client_addr]:[TCP::client_port]: Redirecting to http://ddcpoc.com[HTTP::uri]"

     

    }

     

    default {

     

    log local0. "[IP::client_addr]:[TCP::client_port]: Doing nothing for [HTTP::host][HTTP::uri]"

     

    }

     

    }

     

    }
  • Sorry, Dave. I didn't notice the omission of "Location" until you pointed it out. Now it's so obvious! Glad to hear you've got it working.