menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Saleor Commerce

The world’s fastest growing open-source e-commerce platform with billions of dollars transacted. Powered by Python, GraphQL, ReactJS and PWA.

Channels
Team

CORS policy error on plugins webhooks

July 19, 2021 at 11:42am

CORS policy error on plugins webhooks

July 19, 2021 at 11:42am (Edited 2 months ago)
I have my project running on three different subdomains:
I have configured the following variables with my subdomains ALLOWED_HOSTS ALLOWED_CLIENT_HOST ALLOWED_GRAPHQL_ORIGINS
WORKS: Dashboard , Graphql query from my custom Nuxtjs FrontEnd ERROR: GET or POST to custom plugin Webhook endpoint

My custom plugin and webhook

I have build a custom plugin to send my custom forms without modify the saleor core, and I have defined an endpoint, following the docs.
def webhook(self, request: WSGIRequest, path: str, previous\_value) -> HttpResponse:
if path == '/webhook/contact':
....

How to reproduce

When I just try to GET or POST to my Webhook endpoint
this.$axios.$get(process.env.API_URL+'/plugins/plugin.mailing/webhook/contact')

Response

Access to XMLHttpRequest at 'https://api.mydomain.es/plugins/plugin.mailing/webhook/contact' from origin 'https://www.mydomain.es' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status
Notes: Is posible to solve it with django-cors-headers, but we will get the same CORS error on the Dashboard.
No messages yet