DocumentationFundamentals

CORS for webhooks

Configure CORS for your webhooks to allow requests from other domains.

What is CORS?

CORS is a security feature that allows web applications to make requests to a different domain than the one that served the web page. It is a way to allow web applications to access resources from different domains.

How to configure CORS for your webhooks

Go to your bucket details and click on "Response Configuration" next to the input:

Custom Domains

Then, in the headers section add the following headers:

  • Access-Control-Allow-Origin: *
  • Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
  • Access-Control-Allow-Headers: Content-Type, Authorization

Then, click on "Save" button to apply the changes.

That's it!

That's it! You can now configure CORS for your webhooks to allow requests from other domains.

Alternative Option - Function

You can also create a function with the following code:

r:SetResponseStatusCode(200)
r:SetResponseHeader("Access-Control-Allow-Origin", "*")
r:SetResponseHeader("Access-Control-Allow-Methods", "POST")
r:SetResponseHeader("Access-Control-Allow-Headers", "content-type")

Once created, you need to add this to your input.

Did this page help you?