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

CORS header #10

Open
dtemkin1 opened this issue Aug 19, 2023 · 8 comments
Open

CORS header #10

dtemkin1 opened this issue Aug 19, 2023 · 8 comments
Assignees

Comments

@dtemkin1
Copy link
Collaborator

whenever i request from the backend API, I get the folllwing error:

Access to fetch at 'https://uplink.mit.edu/users/me/lists' from origin 'http://localhost:5173' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

@gabrc52
Copy link
Collaborator

gabrc52 commented Aug 22, 2023

Is this for all requests? I can check when I finish moving

@dtemkin1
Copy link
Collaborator Author

yeah its all requests

@gabrc52
Copy link
Collaborator

gabrc52 commented Aug 23, 2023

image

I don't think the error is about CORS, it just doesn't load at all even without JS sandboxing restrictions

image

<html>
<head><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>

The reason why it results in a CORS error is probably the fact that I'm not adding any headers from nginx and I'm just doing so from Python. I could change the nginx config to add the headers.

@gabrc52
Copy link
Collaborator

gabrc52 commented Aug 23, 2023

image

It also seems that the service crashes when you try to make a request

@gabrc52
Copy link
Collaborator

gabrc52 commented Aug 23, 2023

Okay so running api.py manually does work but the deployment I set with gunicorn just complains about the port being in use:

Aug 23 04:41:31 uplink-testing gunicorn[1329]: [2023-08-23 04:41:31 +0000] [1329] [ERROR] Connection in use: ('0.0.0.0', 8000)
Aug 23 04:41:31 uplink-testing gunicorn[1329]: [2023-08-23 04:41:31 +0000] [1329] [ERROR] Retrying in 1 second.
Aug 23 04:41:32 uplink-testing gunicorn[1329]: [2023-08-23 04:41:32 +0000] [1329] [ERROR] Connection in use: ('0.0.0.0', 8000)
Aug 23 04:41:32 uplink-testing gunicorn[1329]: [2023-08-23 04:41:32 +0000] [1329] [ERROR] Retrying in 1 second.
Aug 23 04:41:33 uplink-testing gunicorn[1329]: [2023-08-23 04:41:33 +0000] [1329] [ERROR] Connection in use: ('0.0.0.0', 8000)
Aug 23 04:41:33 uplink-testing gunicorn[1329]: [2023-08-23 04:41:33 +0000] [1329] [ERROR] Retrying in 1 second.
Aug 23 04:41:34 uplink-testing gunicorn[1329]: [2023-08-23 04:41:34 +0000] [1329] [ERROR] Connection in use: ('0.0.0.0', 8000)
Aug 23 04:41:34 uplink-testing gunicorn[1329]: [2023-08-23 04:41:34 +0000] [1329] [ERROR] Retrying in 1 second.

@dtemkin1
Copy link
Collaborator Author

sobs

@gabrc52
Copy link
Collaborator

gabrc52 commented Aug 24, 2023

I started the development server temporarily, so I think it's running right now

@gabrc52
Copy link
Collaborator

gabrc52 commented Sep 4, 2023

odd i restarted it and it's not crashing anymore (in production mode)

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