Forum Discussion
respond with 417 expextection failed
trying to convert this netscaler config to an irule
add responder action act_417 respondwith "\"HTTP/1.1 417 Expectation Failed\r\n\r\n\"" add responder policy expect_100 "HTTP.REQ.HEADER(\"Expect\").set_text_mode(ignorecase).REGEX_MATCH(re/100-Continue/)" rp_act_expect_417
I think this is what you are after. I don't have a good way to test. The content can be modified or removed as it is the body of the response. HTTP::respond 417 -version 1.1 on its own will return "HTTP/1.1 417 Expectation Failed" if that is all you want.
when HTTP_REQUEST { if { [string tolower [HTTP::header "Expect"]] equals "100-continue" } { HTTP::respond -version 1.1 417 content "Expectation Failed" } }
4 Replies
- mimlo_61970
Cumulonimbus
I think this is what you are after. I don't have a good way to test. The content can be modified or removed as it is the body of the response. HTTP::respond 417 -version 1.1 on its own will return "HTTP/1.1 417 Expectation Failed" if that is all you want.
when HTTP_REQUEST { if { [string tolower [HTTP::header "Expect"]] equals "100-continue" } { HTTP::respond -version 1.1 417 content "Expectation Failed" } }- YELEVISION_1746
Nimbostratus
Thanks mimlo for your reply. It was really helpful. the irule works with minor modification. Please see below: when HTTP_REQUEST { if { [string tolower [HTTP::header "Expect"]] equals "100-continue" } { HTTP::respond 417 -version 1.1 content "Expectation Failed" } } The problem I am now facinfg is it is not closing the connection after sending the response. How do I get it to close the connection after responding? - mimlo_61970
Cumulonimbus
Add an HTTP::close on the next line after the HTTP::respond
- YELEVISION_1746
Nimbostratus
Thanks mimlo for your reply. It was really helpful. the irule works with minor modification. Please see below: when HTTP_REQUEST { if { [string tolower [HTTP::header "Expect"]] equals "100-continue" } { HTTP::respond 417 -version 1.1 content "Expectation Failed" } }
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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
