bsoc-bitbyte / bsoc-bitbyte/Splitt

[BUG] Getting CORS error in dev login.

Open
#11 6 comments 0 reactions 1 assignee Claimed by @basuri01 View on GitHub
bug medium
Dominant language
JavaScript
Stars
14
Forks
22
PR merge metrics
No merged PRs in 30d

Description

### 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:

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

### Logs / Screenshots

Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.