Describe the bug
When vite server.proxy is configured with auth option, I'm expecting basic authentication Auhorization: Basic ${Buffer.from('user:pass').toString('base64')} header to be sent to the upstream, and it is, unless the client sends own authorization header.
It's bug in http-proxy
But since it's patched using pnpm and bundled within vite either this has to be patched as well, or probably a fork of http-proxy can be made within vitejs
Reproduction
https://stackblitz.com/edit/vitejs-vite-cppgeu2m?file=src%2Fcounter.js,src%2Fmain.js,vite.config.js
Steps to reproduce
configure proxy
const proxy = {
'/api/service1': {
target: 'http://localhost:80/endpoint/requiring/basic-auth',
auth: 'user1:pass1',
},
};
export default defineConfig({
server: {
proxy,
},
});
fetch('/api/service1', { headers: { authorization: "anything" } })
### System Info
```shell
not relevant
Used Package Manager
npm
Logs
No response
Validations
Describe the bug
When vite server.proxy is configured with
authoption, I'm expecting basic authenticationAuhorization: Basic ${Buffer.from('user:pass').toString('base64')}header to be sent to the upstream, and it is, unless the client sends own authorization header.It's bug in http-proxy
But since it's patched using pnpm and bundled within vite either this has to be patched as well, or probably a fork of http-proxy can be made within vitejs
Reproduction
https://stackblitz.com/edit/vitejs-vite-cppgeu2m?file=src%2Fcounter.js,src%2Fmain.js,vite.config.js
Steps to reproduce
configure proxy
Used Package Manager
npm
Logs
No response
Validations