You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config/server-options.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,7 @@ Configure custom proxy rules for the dev server. Expects an object of `{ key: op
90
90
91
91
Note that if you are using non-relative [`base`](/config/shared-options.md#base), you must prefix each key with that `base`.
92
92
93
-
Extends [`http-proxy`](https://github.com/http-party/node-http-proxy#options). Additional options are [here](https://github.com/vitejs/vite/blob/main/packages/vite/src/node/server/middlewares/proxy.ts#L13). Note that [unlike http-proxy](https://github.com/http-party/node-http-proxy/issues/1669), the `changeOrigin` option will change both host and origin headers to match the target.
93
+
Extends [`http-proxy`](https://github.com/http-party/node-http-proxy#options). Additional options are [here](https://github.com/vitejs/vite/blob/main/packages/vite/src/node/server/middlewares/proxy.ts#L13).
94
94
95
95
In some cases, you might also want to configure the underlying dev server (e.g. to add custom middlewares to the internal [connect](https://github.com/senchalabs/connect) app). In order to do that, you need to write your own [plugin](/guide/using-plugins.html) and use [configureServer](/guide/api-plugin.html#configureserver) function.
* rewrite the Origin header of a WebSocket request to match the the target
32
+
*
33
+
* **Exercise caution as rewriting the Origin can leave the proxying open to [CSRF attacks](https://owasp.org/www-community/attacks/csrf).**
34
+
*/
35
+
rewriteWsOrigin?: boolean|undefined
30
36
}
31
37
32
-
constsetOriginHeader=(
38
+
constrewriteOriginHeader=(
33
39
proxyReq: http.ClientRequest,
34
-
options: HttpProxy.ServerOptions,
40
+
options: ProxyOptions,
41
+
config: ResolvedConfig,
35
42
)=>{
36
43
// Browsers may send Origin headers even with same-origin
37
44
// requests. It is common for WebSocket servers to check the Origin
38
-
// header, so if changeOrigin is true we change the Origin to match
45
+
// header, so if rewriteWsOrigin is true we change the Origin to match
0 commit comments