#Proxy issue after migrating to vite 7

1 messages · Page 1 of 1 (latest)

wooden wharf
#

After I migrated from vite 6 to vite 7.1.3 the proxy setting doesn't seem to work. i still haven't identified the reason.

from vite.config:

const getGraphProxy = (envVars: Record<string, string>) => ({
"/graphql": {
target: envVars.VITE_API_URL,
changeOrigin: true,
secure: false,
rewrite: () => "",
}
});

const serverConfig = (envVars: Record<string, string>): ServerOptions => ({
port: 9091,
strictPort: true,
allowedHosts: true,
open: true,
proxy: {
...getGraphProxy(envVars),
},
});

VITE_API_URL=https://someurl.com/graphql

vite 6 worked as expected, the request was made to localhost and was proxied to https://someurl.com. in vite 7 i got this in the browser:

Mixed Content: The page at 'https://localhost:9091' was loaded over HTTPS, but requested an insecure resource 'https://someurl.com/graphql'. This request has been blocked; the content must be served over HTTPS

can someone point me in the right direction? thanks

thin arrow
wooden wharf
#

I actually need https. Something changed in v7