Forum Discussion
DarkSideOfTheQ_
Nimbostratus
Jul 14, 2010Return status code and a retry after X value
Hello All,
I was asked today to create an iRule that returned a 503 based off the user-agent string and also a return value of some sort. I have my iRule that will give the 503 but can't quite figure out the 'retry-after' portion of the request. I did some searching and hope I haven't missed a post here, but am wondering if there is a way to return a 503 to someone and tell them to try again in X amount of time???
TIA
-DarkSide
- hoolio
Cirrostratus
Hi DarkSide,when HTTP_REQUEST { Check if the User-Agent header if {[HTTP::header User-Agent] contains "some user-agent string"}{ Send a 503 response with a Retry-After header set to 5 minutes Don't include the Server: BigIP header (noserver) Retry-After described in: http://tools.ietf.org/html/rfc2616section-14.37 HTTP::respond 503 noserver "Retry-After" 300 } }
- DarkSideOfTheQ_
Nimbostratus
Hi Hoolio, - hoolio
Cirrostratus
When you say it doesn't work, do you mean that the Retry-After header isn't set in the response? Else, can you try testing with curl from the LTM command line:when HTTP_REQUEST { HTTP::respond 503 noserver Retry-After 3 }
- hoolio
Cirrostratus
Sorry, I just notice you said you're running 9.2.x. The noserver flag was added in 9.4 to remove the Server: BigIP header. You can use this instead:when HTTP_REQUEST { HTTP::respond 503 Retry-After 3 }
- DarkSideOfTheQ_
Nimbostratus
When I tried to use "Retry-After" 10800 the LTM threw an error when creating the new iRule, so I changed that to "Retry-After:10800" and it accepted it. - hoolio
Cirrostratus
That's exactly it. - DarkSideOfTheQ_
Nimbostratus
Excellent!!!
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