KB Article #178478

How do you send a 204 No Content reply from the API Gateway?

Problem

The Set Message filter complains if you attempt to leave the body blank and there's no obvious way to send a 204 No Content reply from a policy.

Resolution

At the very end of the policy when you are ready to send the 204 No Content reply, use the Remove Attribute filter on content.body and then a Reflect Message filter with a status code of 204.


Warning: Do not remove content.body until you are ready to send the reply. Deleting the content.body attribute may prevent other filters from operating normally, even some that do not appear to reference the body of the message.