Forum Discussion
victor_romero_1
Nimbostratus
Feb 03, 2011illegal argument using HTTP::respond
Hi,
Our application servers return a 200 OK message even if it should be a 404 or 500 error code, so we want to capture that using an iRule and return the right error code depending on the message returned by our app servers:
when HTTP_RESPONSE_DATA {
set page_not_found "The requested page was not found."
set page_not_live "The requested page is not live."
if { ([HTTP::payload] contains "$page_not_found") } {
HTTP::respond 404
}
if { ([HTTP::payload] contains "$page_not_live) } {
HTTP::respond 500
}
}
It seems to be working as expected, however we see in the /var/ltm/log files the following error message:
- Illegal argument. Can't execute in the current context. invoked from within "HTTP::payload"
I take the only mandatory attribute for the HTTP::respond is the error code.
HTTP::respond status_code [content] [noserver] [header_name header value]+
We're using BIG-IP 9.4.8 Build 407.0 hotfix hf4
Any ideas?
Many thanks,
Victor
- JRahm
Admin
try adding the optional arguments: HTTP::respond 404 content "404" - hoolio
Cirrostratus
I didn't think the content parameter was necessary. In a quick test on 10.2.1, I don't see a runtime error when using HTTP::respond 404 with no options. - JRahm
Admin
i don't think it's supposed to be, but I have seen issues with some configurations without it. Could be my sloppy code, though ;-) - victor_romero_1
Nimbostratus
Hi,
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects