Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

302 Found have no Access-Control-Allow-Origin #19330

Open
7 tasks done
rolkey opened this issue Feb 1, 2025 · 0 comments
Open
7 tasks done

302 Found have no Access-Control-Allow-Origin #19330

rolkey opened this issue Feb 1, 2025 · 0 comments

Comments

@rolkey
Copy link

rolkey commented Feb 1, 2025

Describe the bug

My vite.config.ts is

export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd());
  const { VITE_BASE_PATH } = env;
  console.log("VITE_BASE_PATH", VITE_BASE_PATH);
  return {
    base: VITE_BASE_PATH,
    server: {
      host: "0.0.0.0",
      port: 10201,
      watch: { usePolling: true },
      hmr: true,
      headers: {
        // 设置 CORS 头
        "Access-Control-Allow-Origin": "*",
        "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
        "Access-Control-Allow-Headers": "Content-Type, Authorization",
        // "Referrer-Policy": "no-referrer-when-downgrade", // 修改 Referrer-Policy
        "Referrer-Policy": "*", // 修改 Referrer-Policy
      },
    },
  }
}

VITE_BASE_PATH is /wmss,went http://127.0.0.1:10201 ,return 302 Found,but header have no "Access-Control-Allow-Origin": "*

Reproduction

http://127.0.0.1:10201

Steps to reproduce

No response

System Info

Debian, vite, chrome

Used Package Manager

pnpm

Logs

No response

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant