NPM http and socket.io CORS #4442
Unanswered
fenixbinario
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
NPM says http module "Security Hold Packet" how can I get CORS between client and server from different domains?.
source: https://www.npmjs.com/package/http
doc: https://socket.io/docs/v4/server-options/#cors
import { createServer } from "http"; import { Server } from "socket.io";
const httpServer = createServer();
const io = new Server(httpServer, { cors: { origin: ["https://example.com", "https://dev.example.com"], allowedHeaders: ["my-custom-header"], credentials: true } });
Beta Was this translation helpful? Give feedback.
All reactions