diff --git a/app/main.py b/app/main.py index e1c1ff0..68c96d7 100644 --- a/app/main.py +++ b/app/main.py @@ -11,7 +11,8 @@ ALLOWED_ORIGINS = [ "http://192.168.10.94/", "http://192.168.10.94:8080/", "http://localhost:8080", - "http://localhost" + "http://localhost", + "http://172.17.0.1:38500" ] app.add_middleware( diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..5eba154 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,23 @@ +location /coditech/ { + proxy_pass http://127.0.0.1:38500/; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # CORS for public (no credentials) + add_header Access-Control-Allow-Origin * always; + add_header Access-Control-Allow-Methods GET,POST,OPTIONS always; + add_header Access-Control-Allow-Headers Origin,Content-Type,Accept,Authorization always; + + # Preflight + if ($request_method = OPTIONS) { + add_header Access-Control-Allow-Origin *; + add_header Access-Control-Allow-Methods GET,POST,OPTIONS; + add_header Access-Control-Allow-Headers Origin,Content-Type,Accept,Authorization; + add_header Access-Control-Max-Age 1728000; + add_header Content-Length 0; + return 204; + } +} \ No newline at end of file