Forum Discussion

Saskia_81056's avatar
Saskia_81056
Icon for Nimbostratus rankNimbostratus
May 23, 2013

http::respond in HTTP_RESPONSE

Hey guys,

 

i'm currently trying to write a iRule which spits out a HTML site for redirection purposes.

 

For this I have a HTTP_REQUEST in which I set a varible. In the HTTP_RESPONSE i check if this variable exists and if the status code is 404.

 

If so, I do a HTTP::respond 200 content "...html content here"

 

I tried it before without the status code check and put the same HTTP::respond code within the HTTP_REQUEST part which was working like a charm.

 

But as soon as I put it within the HTTP_RESPONSE part the site just gives me a RESET.

 

I also tried it plain without any ifs which also wasn't working.

 

 

when HTTP_RESPONSE {

 

log local0. "Test"

 

HTTP::respond 200 content "bla"

 

}

 

 

The HTTP_RESPONSE fires which I can see in the log but then I just get a reset.

 

 

Do you know this behavior? Am I doing anythin wrong??

 

 

Best Regards

 

Sam

 

1 Reply

  • does curl work?

    [root@ve10:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.252:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve10:Active] config  b rule myrule list
    rule myrule {
       when HTTP_RESPONSE {
      log local0. "Test"
      HTTP::respond 200 content "bla\r\n"
    }
    }
    [root@ve10:Active] config  curl -i http://172.28.19.252
    HTTP/1.0 200 OK
    Server: BigIP
    Connection: Keep-Alive
    Content-Length: 5
    
    bla