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

Preflight Pending #5

Closed
anklav24 opened this issue Jun 13, 2022 · 3 comments
Closed

Preflight Pending #5

anklav24 opened this issue Jun 13, 2022 · 3 comments

Comments

@anklav24
Copy link
Contributor

When I try to log in, I have in a browser Preflight Pending (Network DevTools), but with curl all works right. What I need to do? Is that a CORS issue?

Request
curl -X POST http://nzxt-home-pc.local:3000/api/v1/auth/login -H 'Content-Type: application/json' -d '{"username":"admin", "password":"admin"}'

Answer
{"user":{"id":1,"name":"Default Admin","username":"admin","isSuperAdmin":true,"createdAt":"2022-06-13T11:23:48.000Z","updatedAt":"2022-06-13T11:23:48.000Z"},"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoxLCJuYW1lIjoiRGVmYXVsdCBBZG1pbiIsInVzZXJuYW1lIjoiYWRtaW4iLCJpc1N1cGVyQWRtaW4iOnRydWUsImNyZWF0ZWRBdCI6IjIwMjItMDYtMTNUMTE6MjM6NDguMDAwWiIsInVwZGF0ZWRBdCI6IjIwMjItMDYtMTNUMTE6MjM6NDguMDAwWiJ9LCJpYXQiOjE2NTUxMjQ5NzUsImV4cCI6MTY1NzcxNjk3NX0.1OdbNTmz7PHlWceLyfeJbh9uh7gKC11c_63dzV3

@milutinke
Copy link
Owner

milutinke commented Jun 15, 2022

Which OS and Browser are you using?
CORS is enabled for all by default.
The only thing comes to my mind is that either it's the browser itself or some extension causing the issue.
I've used this on all of the major browsers without any issues.

@anklav24
Copy link
Contributor Author

I found a problem. I used the Dockerfile with some of my changes from #1 and needed to changed frontend/squad-control-panel/src/main.js. So my bad.

@milutinke
Copy link
Owner

Yeah, the problem is that the author of #1 used ENV variable in a variable on the front end which is supposed to store the URL of back end.
My idea for fixing it would be making some sort of placeholder in that variable and then running a script to replace it when docker needs to build the front end and then move it to the backend/dist.
Feel free to contribute if you need to use docker, I've never utilized docker.

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

No branches or pull requests

2 participants