Forum Discussion

Mark_Cloutier's avatar
Mark_Cloutier
Icon for Nimbostratus rankNimbostratus
Feb 04, 2012

iRule for HTTP 204 response with content-type

Trying to support Google Advanced Search Reporting

 

 

request was to have an http response for a uri starting with /static/img/click that looks like the one that comes from our Google Search appliance which is shown below

 

 

HTTP/1.1 204 No Content

 

Date: Wed, 25 Jan 2012 15:31:30 GMT

 

Content-Type: image/gif

 

Content-Length: 0

 

Connection: close

 

 

Here is the irule I have

 

 

when HTTP_REQUEST {

 

if {[ matchclass [HTTP::uri] starts_with $::http_204_uris] } {

 

HTTP::respond 204 noserver

 

log local0. "sent 204"

 

}

 

 

The response being seen is

 

 

HTTP/1.0 204 No Content

 

Connection: Keep-Alive

 

Content-Length: 0

 

 

 

How can I insert the content-type :image/gif and change the connection value from Keep-Alive to close? I'd alos like to set it to be HTTP/1.1 but the irules reference for HTTP RESPONE makes me this I don't have these options :(

 

1 Reply

  • can you try this?

    [root@ve1023:Active] config  b virtual bar list
    virtual bar {
       snat automap
       pool foo
       destination 172.28.19.79:80
       ip protocol 6
       rules myrule
       profiles {
          http {}
          tcp {}
       }
    }
    [root@ve1023:Active] config  b rule myrule list
    rule myrule {
       when HTTP_REQUEST {
       if {[string tolower [HTTP::uri]] starts_with "/static/img/click"} {
          HTTP::respond 204 noserver "Content-Type" "image/gif" "Connection" "Close"
       }
    }
    }
    
    [root@ve1023:Active] config  curl -I http://172.28.19.79/static/img/click/test
    HTTP/1.0 204 No Content
    Content-Type: image/gif
    Connection: close
    Content-Length: 0