Reject requests based on content-type header, lambda-proxy


I have a lambda function set up with API gateway, lambda-proxy integration.
I have set up a schema validation for the JSON payload, which works a treat if the request has a Content-Type:application/json header.

I would like to be able to reject a request that does not have a Content-Type:application/json header. I can see this is possible using the lambda integration, but I cannot see how to do this in a lambda-proxy. Is it possible at all?

Many thanks

@gaiachik If you are setting the lambda proxy means, no ways that you can reject. See proxy means what, pass the request directly to the actual endpoint without any API activity inside. Else remove the proxy and do the operations.

1 Like

thank you. I was entirely missing the point of what “lambda-proxy” actually means.
Now it makes a lot of sense… a bit of a duh moment :see_no_evil:

1 Like