Last active
October 7, 2021 02:42
-
-
Save alex-hladun/41ba9e7b0557b8e9f375aa8a8d6b4839 to your computer and use it in GitHub Desktop.
Setting up cors on the back-end
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// On the back-end | |
this.io = new Server(server, { | |
cors: { | |
// Would change origin to eventual DNS for React app | |
origin: "http://localhost:3000", | |
methods: ["GET", "POST"], | |
credentials: true | |
}, | |
allowEIO3: true, // Whether to enable compatibility with Socket.IO v2 clients. | |
maxHttpBufferSize: 1024, // max message payload size (prevents clients from sending gigabytes of data) | |
pingInterval: 45 * 1000, // 45 seconds (less than ALB timeout) | |
pingTimeout: 4 * 60 * 1000 // 4 minutes | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment