Closed PedroReyes closed 1 year ago
Hi Pedro, I'm curious why are you using mode: 'no-cors'
? Doesn't that block content coming from other origins?
Hello @sintaxi ,
If I use mode: 'no-cors'
the result is:
Access to fetch at 'https://obedient-beam.surge.sh/deployments'
(redirected from 'http://obedient-beam.surge.sh/deployments')
from origin 'http://localhost:6006' has been blocked by CORS policy:
Response to preflight request doesn't pass access control check:
The value of the 'Access-Control-Allow-Origin' header in the response
must not be the wildcard '*' when the request's credentials mode is 'include'
And if I try to remove the mode:
Access to fetch at 'https://obedient-beam.surge.sh/deployments'
from origin 'http://localhost:6006' has been blocked by CORS policy:
Response to preflight request doesn't pass access control check:
It does not have HTTP ok status.
I don't know what I am doing wrong 🤔
By any chance, are you using it with Surge Free? Since this is a Surge Professional only feature.
https://surge.sh/help/enabling-cross-origin-resource-sharing It's listed at the bottom of this page. I thought it could be at the top of the page.
Hello @fu-sen ,
You are completely right, I missed that panel. To be honest I thought it was an ad so I ignored him completely from my reading.
The same happened to me with the follow along - I found that repository from the wild internet, not from the docs 😅
Thanks @fu-sen for helping me out.
Best regards, Pedro Reyes.
@sintaxi Can you improve this page? If you continue like this, you may encounter the same useless problem in the future.
Hello,
👁 Context
I am trying to access a json file I have stored in my surge.sh website. The content of the website is:
<body>
*
.I simply use the next command
echo '*' > CORS
❌ Problem
I have followed the next steps: https://surge.sh/help/enabling-cross-origin-resource-sharing
However, when I try to access the json file located here: https://obedient-beam.surge.sh/deployments. Using the next code:
I get the next opaque empty response as if no CORS had been setup:
Thanks in advance for the help.
Best regards, Pedro Reyes.