Skip to content

Vite proxy issue after migrating to vite 7.1.3 #20665

@andrei10k

Description

@andrei10k

Describe the bug

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

Reproduction

no url

Steps to reproduce

No response

System Info

-

Used Package Manager

pnpm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: devdev serverp2-edge-caseBug, but has workaround or limited in scope (priority)regressionThe issue only appears after a new release

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions