Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options to socket.io server #508

Closed
PashaX opened this issue Mar 14, 2018 · 4 comments
Closed

Options to socket.io server #508

PashaX opened this issue Mar 14, 2018 · 4 comments

Comments

@PashaX
Copy link

PashaX commented Mar 14, 2018

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

Can not provide options to socket.io server when initialize

Expected behavior

Possibility to add option when creating socket.io server

Minimal reproduction of the problem with instructions

Can not to do something like this:

const io = require('socket.io')(3000, {
  handlePreflightRequest: function (req, res) {
    var headers = {
      'Access-Control-Allow-Headers': 'Content-Type, Authorization, x-token',
      'Access-Control-Allow-Origin': 'http://localhost:3001',
      'Access-Control-Allow-Credentials': true
    };
    res.writeHead(200, headers);
    res.end();
  }
});

What is the motivation / use case for changing the behavior?

W need this to resolve problem with x-origin request

Environment


Nest version: 4.6.6

 
For Tooling issues:
- Node version: 8.9.0  
- Platform: fedora 27  

Others:

@kamilmysliwiec
Copy link
Member

Hi,
Thanks for reporting. Added to backlog 🙂

@kamilmysliwiec
Copy link
Member

Available in the incoming v5.0.0 release.
Docs: https://docs.nestjs.com/v5

@kamilmysliwiec kamilmysliwiec added this to the 5.0.0 milestone Apr 20, 2018
@JulienStitelet
Copy link

Hi, using nestjs 5.4 I cannot see how to use this.
Here's how I tried:

app.enableCors({
methods: ['GET', 'POST', 'PUT', 'DEL', 'OPTIONS'],
origin: ':',
// allowedHeaders: ['authorization'],
preflightContinue: true,
optionsSuccessStatus: 200,
});

trying a lot, but don't find anything.
my frontend is angular 7, connecting with extraHeader for authorization header

If you have time to help me.. thank you

@lock
Copy link

lock bot commented Sep 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants