score:1
Accepted answer
passing the cors parameters into the socketio
constructor resolved the issue, as follows:
const io = socketio(server,{
cors: {
origin: "http://localhost:3000",
methods: ["get", "post"],
credentials:true
}
});
score:0
double check at your allowedheaders
and allowed methods
, working example:
const corsoptions = {
allowedheaders: ['x-access_token', 'access-control-allow-origin', 'authorization', 'origin', 'x-requested-with', 'content-type', 'content-range', 'content-disposition', 'content-description'],
credentials: true,
methods: 'get,head,options,put,patch,post,delete',
origin: ['http://macog.local:5001','http://localhost:5001', 'https://app.foo.com', 'http://10.0.2.2:5001'],
preflightcontinue: false
};
Source: stackoverflow.com
Related Query
- Using require('cors') but still getting CORS error
- CORS enabled using Express but still getting CORS error
- Getting an error "A non-serializable value was detected in the state" when using redux toolkit - but NOT with normal redux
- WebRTC getting Failed to execute 'addIceCandidate' on RTCPeerConnection error on console but can still display remote and local videos
- Using Ag-Grid Enterprise license getting a 'ag-grid: Looking for component [agSetColumnFilter] but it wasn't found." error
- Using GatsbyImage - I keep getting an error Failed prop type: The prop `image` is marked as required in `GatsbyImage`, but its value is `undefined`
- Using react polyfills but getting error Object doesn't support property or method 'repeat' in IE11
- API call getting CORS error in ReactJS but getting response in node and postman
- Reactjs app building successfully when deploying with Heroku but still getting Application Error
- I am using gh-pages to deploy a github page but I'm getting an error now when it was working fine before
- Using Symfony as a backend and getting CORS error
- Trying to add an array of objects using react useState but getting the error 'Objects are not valid as a React child (found: object with keys {})'
- Attempting to add multiple items to SP list using sp/pnp but getting error on ```createBatch()```
- Trying to deploy React App to Azure using a Github Actions workflow but getting an error in TypeScript
- Getting CORS error when using PassportJS for Google OAuth in React/Express
- Why am I getting an error with cors in ExpressJS in one case, but not the other?
- Using a Provider but still seeing error Invariant Violation: Could not find "store" in the context of "Connect
- Want to send JWT token in headers along with data using axios but getting this error : Cannot set headers after they are sent to the client
- I'm getting error using laravel and react "Invalid DOM property `for`. Did you mean `htmlFor`"
- CSS Emotion Library - Getting css props error when using css prop
- Why is IE8 getting a script error when using Facebook's React.js
- Getting 400 error Bad request using axios
- Getting the error "Nested CSS was detected, but CSS nesting has not been configured correctly" in React app?
- use babel-jest for jest but still get syntax error
- Getting an out of memory error while using Create React App and Plotly.js
- esModuleInterop flag set, still getting default import error
- Getting error when using FormattedMessage inside a module: Error: [React Intl] Could not find required `intl` object
- Getting error - A column id is required if using a non-string accessor for column above - React
- using ...spread, but redux still throws warning about state mutation
- I am trying to install new component using npm. But it gives error
More Query from same tag
- Why does this mock api not work as expected?
- React - selenium tests
- Destructuring binding to a function?
- React-Redux clock dosen't update it's state in DOM
- Cannot Get when running Webpack Config in React.js 2020
- How to get the material ui Button component content value onclick
- How to write interceptor in react-redux?
- Can't install any package with npm
- Getting partial text when copying and modifying a text
- How can I collapse an accordion from a child component in react
- RTL on MuiTextField goes wrong using Special Charcters
- How to add new attributes to Material UI Shadows | Typescript
- Should I use Ant.Design or MaterialUI or React-Bootstrap?
- React js webpage with language translate function(manual)
- How to use setState call back to update value prop of TextInput
- Having child route use parent props in react
- Updating state in async function
- Remove ESLint from React project
- Is there a way to make the navbar dropdown expand below a collapsed navbar?
- I can't access html element inside useEffect
- Webpack - Failed to generate the compiled files, or even the dist folder
- React handle fetch API response in one place
- How to import chartist in react component?
- Do I need to store isUserSignIn for componet rendering in Local Storage(React,Next,Firebase Auth)
- I am trying to use react-simple-nav in my project but unexpectedly does not show up. Someone, could say what I am missing here?
- How can I change component local state using parameters?
- TypeError: dispatch is not a function when I try to test a method using JEST
- REACT- My condition is working partially why?
- How can i set display flex in my react slider?
- connect multiple reducers using decorator in redux