File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Agent } from 'node:http'
12import { fileURLToPath , URL } from 'node:url'
23import vue from '@vitejs/plugin-vue'
34import vueJsx from '@vitejs/plugin-vue-jsx'
@@ -81,6 +82,22 @@ export default defineConfig(({ mode }) => {
8182 changeOrigin : true ,
8283 secure : false ,
8384 ws : true ,
85+ timeout : 5000 ,
86+ agent : new Agent ( {
87+ keepAlive : false ,
88+ } ) ,
89+ onProxyReq ( proxyReq , req ) {
90+ proxyReq . setHeader ( 'Connection' , 'keep-alive' )
91+ if ( req . headers . accept === 'text/event-stream' ) {
92+ proxyReq . setHeader ( 'Cache-Control' , 'no-cache' )
93+ proxyReq . setHeader ( 'Content-Type' , 'text/event-stream' )
94+ }
95+ } ,
96+ onProxyReqWs ( proxyReq , req , socket ) {
97+ socket . on ( 'close' , ( ) => {
98+ proxyReq . destroy ( )
99+ } )
100+ } ,
84101 } ,
85102 } ,
86103 } ,
You can’t perform that action at this time.
0 commit comments