Skip to content

[BUG] Getting CORS error in dev login. #11

@basuri01

Description

@basuri01

Browser

Chrome

Area

Auth (login / Google sign-in)

Steps to reproduce

Start the server on any frontend port other than 5173.

Expected behavior

The application should work on any frontend port.

What actually happened

While setting up the project, I was facing CORS error in dev login.
Image

This happened because vite picked up some other port than 5173, which is hardcoded in the backend for course.

This can be solved by setting up a backend proxy in vite.config.js:

export default defineConfig({
  plugins: [react()],},
  server: {
    port: 5173,
    proxy: {
      '/api': {
        target: 'http://localhost:3000',
        changeOrigin: true,
      },
    },
  },
});

Logs / Screenshots

Image

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingmediummedium level issue

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions