Forum Discussion
HTTP::respond and HTTP/1.0
The response generated is always an HTTP/1.0 response. I was wondering why there is no option to return an HTTP/1.1 response or if there is, how would I do it?
-Al
10 Replies
- hoolioCirrostratus Is this for HTTP or HTTPS? If for HTTP, you could set the HTTP version to 1.1 using TCP::respond (Click here):
 TCP::respond “HTTP/1.1 200 OK\r\nHi\r\n\r\n”
 Is there a specific reason you need to use HTTP 1.1 for the response?
 Aaron
- Al_Carandang_11Nimbostratus It is for HTTPS and I did use the TCP::respond solution for the HTTP case.
 I'm trying to work around some possible browser bug(s) which make it behave incorrectly when it thinks it's talking to a HTTP/1.0 server. Our theory is that the HTTP/1.0 response from our iRule is causing the browser to think this is the case.
- hoolioCirrostratus You could potentially use an ugly hack with an HTTPS VIP + client SSL profile pointing to an HTTP VIP with a TCP::respond iRule. Or maybe it would be easier to use an interception proxy on the client to rewrite the response.
 Aaron
- spark_86682Historic F5 AccountIf you're on v10.x, then you can use SSL::respond for the HTTPS case. Otherwise, I think hoolio's vip-to-vip solution is your only option.
- Al_Carandang_11Nimbostratus We'll be upgrading to V10.0 soon so I'll wait for that to happen.
 Thanks!
- praveen_73358Nimbostratus Dear All,
 We have a F5 with version IP 10.0.1 Build 378.0 Hotfix HF3.
 I need HTTP/1.1 response from the F5 with 502 code for a HTTPS VIP.
 We have tried the below iRule using SSL::respond:
 when LB_FAILED {
 SSL::respond "HTTP/1.1 502 Bad Gateway\r\nServer: BigIP\r\nConnection: close\r\nContent-Length: 0\r\n\r\n"
 }
 However the desired output was not obtained.As per the previous updates above I see that this should work in version 10.
 Can anyone update if there is any issue with the iRule we tested.
 Thanks,
 Praveen
- hoolioCirrostratus Praveen,
 Can you try HTTP::respond instead?
 Aaron
- hoolioCirrostratus Hi Praveen,
 Please see my reply here:
 http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/afv/topic/aft/1176945/aff/5/showtab/groupforums/Default.aspx
 Aaron
- hoolioCirrostratus In 11.2, an option was added to HTTP::respond which allows you to specify the response version: https://devcentral.f5.com/wiki/iRules.http__respond.ashx HTTP::respond [-version [1.0|1.1] ] [content < content value >] [noserver] [< header name > < header value >]+Note: The -version flag was added in 11.2.0. It must immediately follow the status code and precede the content (if any) and any other flags. You could check the client's HTTP version using [HTTP::version] in HTTP_REQUEST: when HTTP_REQUEST { set version [HTTP::version] } when HTTP_RESPONSE { if {$some_condition == 1}{ Use 1.0 unless the client version was 1.1 if {$version ne "1.1"}{ set version "1.0" } Send the response with the version set explicitly, no BIG-IP server header and some custom headers HTTP::respond 200 -version $version content "< html >Hi" noserver header1 value1 header2 value2 } }Aaron 
- hoolioCirrostratus In 11.2, an option was added to HTTP::respond which allows you to specify the response version: https://devcentral.f5.com/wiki/iRules.http__respond.ashx HTTP::respond < status code > [-version [1.0|1.1] ] [content < content value >] [noserver] [< header name > < header value >]+Note: The -version flag was added in 11.2.0. It must immediately follow the status code and precede the content (if any) and any other flags. You could check the client's HTTP version using [HTTP::version] in HTTP_REQUEST: when HTTP_REQUEST { set version [HTTP::version] } when HTTP_RESPONSE { if {$some_condition == 1}{ Use 1.0 unless the client version was 1.1 if {$version ne "1.1"}{ set version "1.0" } Send the response with the version set explicitly, no BIG-IP server header and some custom headers HTTP::respond 200 -version $version content "< html >Hi" noserver header1 value1 header2 value2 } }Aaron 
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com