fastify / fastify/fastify-websocket
Setting custom headers on initial WebSocket HTTP Upgrade response
- Dominant language
- JavaScript
- Stars
- 468
- Forks
- 84
- PR merge metrics
- No merged PRs in 30d
Description
### Prerequisites
- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the feature has not already been requested
### 🚀 Feature Proposal
I'm building an HTTP reverse proxy using fastify.
In order to support other 3rd parts WebSocket connections, proxied by my software, I need a way to rewrite headers obtained in UPGRADE response from the replicated WS connection.
Is there a way to write some custom header in the initial upgrade request?
### Example
In my case I have to replicate this headers:
Connection: upgrade
**Content-Type: application/octet-stream**
Date: Tue, 24 May 2022 16:19:40 GMT
**Sec-WebSocket-Accept: MGhCOJFY8ayJUf3cJ+BcSgTwOOg=**
**Sec-WebSocket-Extensions: permessage-deflate**
Sec-WebSocket-Protocol: tty
**Server: Python/3.9 aiohttp/3.8.1**
Upgrade: websocket
But from the reverse proxy I obtain this response:
Connection: Upgrade
Sec-WebSocket-Accept: 0hWXq3owSgRUjfyWd9dJpW6+lm0=
Sec-WebSocket-Protocol: tty
Upgrade: websocket
I have some missing fields and one to rewrite
Contributor guide
Assessment
This issue has not been assessed yet.