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
In my project, I need to automatically upgrade my HTTP or HTTPS requests to WebSocket (WS) or Secure WebSocket (WSS) requests, something I can easily configure in Nginx. However, in vite.config.ts, how can I achieve the same using server.proxy?
just like down below in nginx
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In my project, I need to automatically upgrade my HTTP or HTTPS requests to WebSocket (WS) or Secure WebSocket (WSS) requests, something I can easily configure in Nginx. However, in vite.config.ts, how can I achieve the same using server.proxy?
just like down below in nginx
location /my-websocket-app/ { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; }
我在项目中,将需要使用到 nginx 配置中的 upgrade 设置,将我的 http或 https 请求自动升为 ws 或 wss 请求,在 nginx 中我能正常配置,但是在 vite.config.ts 中,我如何通过 server.proxy 的方式配置呢?
就像上方展示的在 nginx 中配置的情况!
Beta Was this translation helpful? Give feedback.
All reactions