Layer7 API Management

Expand all | Collapse all

Handling error 3021: HTTP method {0} not allowed for service {1}

Jump to Best Answer
  • 1.  Handling error 3021: HTTP method {0} not allowed for service {1}

    Posted 05-29-2015 03:17 AM

    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?

     

    Thanks,



  • 2.  Re: Handling error 3021: HTTP method {0} not allowed for service {1}

    Posted 06-01-2015 06:19 AM

    What are you trying to do once you 'catch' these?



  • 3.  Re: Handling error 3021: HTTP method {0} not allowed for service {1}

    Posted 06-01-2015 10:46 AM

    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



  • 4.  Re: Handling error 3021: HTTP method {0} not allowed for service {1}
    Best Answer

    Posted 06-01-2015 10:52 AM

    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.



  • 5.  Re: Handling error 3021: HTTP method {0} not allowed for service {1}

    Posted 06-01-2015 10:55 AM

    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



  • 6.  Re: Handling error 3021: HTTP method {0} not allowed for service {1}

    Posted 06-03-2015 07:38 PM

    Thanks Eric! That document is very helpful.



  • 7.  Re: Handling error 3021: HTTP method {0} not allowed for service {1}