【发布时间】:2022-01-18 23:48:32
【问题描述】:
我尝试通过基本身份验证连接到使用 vite 的 URL。凭据正确,但会打开一个空的表单字段。
export default defineConfig({
base: './',
server: {
proxy: {
'/data': {
target: 'https://user:password@example.com/foo',
changeOrigin: true,
}
},
}});
遗憾的是,这不起作用 - 我在这里找到了一个相关问题 https://serverfault.com/questions/371907/can-you-pass-user-pass-for-http-basic-authentication-in-url-parameters,但我不清楚此功能是否仍受支持。
是否可以在 vite config 中修改请求头,直接在请求中注入凭证?
【问题讨论】:
标签: node.js authentication basic-authentication http-proxy vite