-
-
Notifications
You must be signed in to change notification settings - Fork 103
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
It would be great to have the ability to overwrite or modify the queryString when proxying websockets. Possibly adding a queryString property to the wsClientOptions, in the same way that there is already a rewriteRequestHeaders in the wsClientOptions
Motivation
When proxying regular http connections, the queryString in replyOptions can be used to rewrite or modify the query string. https://github.com/fastify/fastify-reply-from?tab=readme-ov-file#querystring-or-querystringsearch-requrl
A websocket API I want to proxy requires passing an auth token as query parameter and I want to make a proxy with this library to inject it.
Example
fastify.register(require('@fastify/http-proxy'), {
websocket: true,
wsUpstream: 'wss://some-domain.com',
wsClientOptions: {
queryString(search, reqUrl, req) {
return {
authToken: req.authToken
};
}
}
})Metadata
Metadata
Assignees
Labels
No labels