How to enable cors for pusher

I have this setting for routeRules: export default defineNuxtConfig({ routeRules; { '/': { cors:true, headers: { 'Access-Control-Allow-Origin' : '' } }, '/**': { cors:true, headers: { 'Access-Control-Allow-Origin' : '' } }, } }) I still get this in the console"
en/paraguay-residency:1 Access to XMLHttpRequest at 'https://sockjs.pusher.com/pusher/app//931/4d86r472/xhr?protocol=7&client=js&version=8.0.2&t=1683052939583&n=47' from origin 'https://booking.learntheropes.xyz' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

POST https://sockjs.pusher.com/pusher/app//931/4d86r472/xhr?protocol=7&client=js&version=8.0.2&t=1683052939583&n=47 net::ERR_FAILED
en/paraguay-residency:1 Access to XMLHttpRequest at 'https://sockjs.pusher.com/pusher/app//931/4d86r472/xhr?protocol=7&client=js&version=8.0.2&t=1683052939583&n=47' from origin 'https://booking.learntheropes.xyz' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

POST https://sockjs.pusher.com/pusher/app//931/4d86r472/xhr?protocol=7&client=js&version=8.0.2&t=1683052939583&n=47 net::ERR_FAILED
Pusher support is still saying I have to enable cors. What should I do? I'm getting crazy since 2 days.
4 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
learntheropes
learntheropesOP3y ago
I'm using Nitro, that is the default server on Nuxt 3. How do I add headers to pusher? Shouldn't they do that?? There should be something really easy that I'm missing here. I don't get how I'm supposed to set headers for a server that is not under my control.
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
learntheropes
learntheropesOP3y ago
Resolved. Cors was ok. I was missing some env variables in production 😬 Thank you for your help

Did you find this page helpful?