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

Send Additional Cookies in Handshake #557

Closed
1 of 2 tasks
jaykravetz opened this issue Apr 19, 2018 · 1 comment
Closed
1 of 2 tasks

Send Additional Cookies in Handshake #557

jaykravetz opened this issue Apr 19, 2018 · 1 comment

Comments

@jaykravetz
Copy link

jaykravetz commented Apr 19, 2018

Note: for support questions, please use one of these channels: stackoverflow or slack

You want to:

  • report a bug
  • request a feature

Current behaviour

Steps to reproduce (if the current behaviour is a bug)

Expected behaviour

Setup

  • OS:
  • browser:
  • engine.io version:

Other information (e.g. stacktraces, related issues, suggestions how to fix)

I would like to add a feature to allow additional cookies besides just this.cookie || 'io' to be set in the handshake.

I will have an example shortly.

Edited

jaykravetz@3b629d2

@jaykravetz jaykravetz mentioned this issue Jan 17, 2019
5 tasks
darrachequesne added a commit that referenced this issue Apr 30, 2021
Those events will be emitted before the response headers are written to
the socket:

- "initial_headers": on the first request of the connection
- "headers": on all requests

Syntax:

```js

server.on("initial_headers", (headers, req) => {
  headers["test"] = "123";
  headers["set-cookie"] = "mycookie=456";
});

server.on("headers", (headers, req) => {
  headers["test"] = "789";
});
```

Related:

- #557
- socketio/socket.io#3630
darrachequesne added a commit that referenced this issue Apr 30, 2021
Those events will be emitted before the response headers are written to
the socket:

- "initial_headers": on the first request of the connection
- "headers": on all requests (HTTP long-polling and WebSocket upgrade)

Syntax:

```js

server.on("initial_headers", (headers, req) => {
  headers["test"] = "123";
  headers["set-cookie"] = "mycookie=456";
});

server.on("headers", (headers, req) => {
  headers["test"] = "789";
});
```

Related:

- #557
- socketio/socket.io#3630
@darrachequesne
Copy link
Member

This was implemented in 2527543, and included in engine.io@5.1.0.

Syntax:

server.on("initial_headers", (headers, req) => {
  headers["test"] = "123";
  headers["set-cookie"] = "mycookie=456";
});

server.on("headers", (headers, req) => {
  headers["test"] = "789";
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants