Modifications to the server.proxy
in the plugin API configureServer
did not take effect
#18056
Closed
7 tasks done
Labels
Describe the bug
I tried writing a plugin to switch
server.proxy
in the development environment for dynamically changing the proxy, but it didn't seem to actually switch during runtime. I tested switching other configurations of the server, such asserver.port
, and they worked fine.Reproduction
https://stackblitz.com/edit/vitejs-vite-mqmnh4?file=vite-plugin-proxy-switch.ts
Steps to reproduce
Clicking the button at the bottom right of the preview switches the
server.proxy
configuration, and clicking the count button triggers a fetch request. By checking the request domain and the identifier in the request headers in the console, you can see that theserver.proxy
configuration switch did not take effect. However, directly modifying theuseFirstProxy
variable in the code allows the switch to work as expected.System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: