Allowed CORS Origins form: how to use properly? Curious about CORS errors. #3907
-
Is this the expected result for the comma-separated list of origins for CORS access? Is it necessary to include all of these strings in the list? What is the proper format here? I've taken a look at #2890 If I delete this list, the cloud runs without any cors errors but why are the url's indicated in the error list not whitelisted given the above list? Ultimately trying to test a feature that requires fetching from an external api and I would like to whitelist it here as well. I've tried: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Thanks for the detailed explanation! Hmmm, the external api needs to include the "Access-Control-Allow-Origin" header in the response. For example, https://my-hub.com makes a request to https://i-heart-my-api.com (or any request). https://i-heart-my-api.com response needs to have For a recent project of mine, using Socket.io on my local environment. The reason I need the "Access-Control-Allow-Origin" header is because my server is running on In my server code, I configure my socket to include the "Access-Control-Allow-Origin" header, looks like this: let io = require('socket.io')(http, {
cors: {
origin:
'https://hubs.local:8080',
},
}) Or if you use node.js + cors: const express = require('express');
const app = express()
const cors = require("cors")
// More configuration options for cors from: https://www.npmjs.com/package/cors#configuration-options
app.use(cors({origin: true})) // includes the header `Access-Control-Allow-Origin`and assigns it to the url origin of the request Hope this helps! |
Beta Was this translation helpful? Give feedback.
Thanks for the detailed explanation!
Hmmm, the external api needs to include the "Access-Control-Allow-Origin" header in the response.
For example, https://my-hub.com makes a request to https://i-heart-my-api.com (or any request). https://i-heart-my-api.com response needs to have
Access-Control-Allow-Origin: https://my-hub.com
in the header of the response.For a recent project of mine, using Socket.io on my local environment. The reason I need the "Access-Control-Allow-Origin" header is because my server is running on
http://localhost:3000
and hubs is running onhttps://hubs.local:8080
orhttps://localhost:8080
.In my server code, I configure my socket to include the "Access-Control-Allo…