Say I've got a service /hello, with the Allowed HTTP Methods in Service Properties only set to GET.
If I now POST to /hello, I get an error 3021 (HTTP method POST now allowed for service hello).
How do I catch these service resolution errors? I'm guessing it is in message-received, but how do I do this?
What are you trying to do once you 'catch' these?
Not sure if this was intentional, but goeer03 just posted a Document that seems to address your use case.
Customizing HTTP responses and status codes when an HTTP method is not allowed
At a bare minimum--you can action something like this in the message-received global policy and the request.http.method variable. This will allow you to execte policy decisions before the Gateway's default 302 response is triggered.
I just authored a document with an accompanying sample policy that should help! It can be found here: Customizing HTTP responses and status codes when an HTTP method is not allowed. This is a fairly specific use-case that digs in to the Gateway database.
I am currently working on tracking down any and all development incidents that may seek to enhance this capability.
Development incident SSG-9565 had been opened previously for this request. Please open a new CA Support issue at CA API Management Support (formerly Layer 7) and reference this communities thread if you would like further information on this incident
Thanks Eric! That document is very helpful.