Feature(s) impacted
Authentication in production environment
Observed behavior
The request is not handled by my Nginx server :
I can see an access record saved by nginx that confirm that the request is received :
[22/Feb/2023:18:34:17 +0000] "OPTIONS /forest/authentication HTTP/1.1" 204 0 "https://app.forestadmin.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0"
And there’s an error log too :
2023/02/22 16:06:48 [error] 3015199#3015199: *5449 connect() failed (113: Unknown error) while connecting to upstream, client: <MY IP>, server: dimikev-v3.api.codingbill.com, request: "GET /forest HTTP/1.1", upstream: "http://172.17.0.4:3310/forest", host: "dimikev-v3.api.codingbill.com", referrer: "https://app.forestadmin.com/"
I tried to
Update my nginx configuration by adding Cors policies like so :
server {
server_name dimikev-v3.api.codingbill.com;
access_log /var/log/nginx/dimikev-v3-access.log;
error_log /var/log/nginx/dimikev-v3-error.log;
add_header 'Access-Control-Allow-Origin' "app.forestadmin.com" always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always;
// ...... first lines of nginx.conf
}
Context
- Project name: dimikev_back_2
- Environment name: production
- Agent type & version: Node js
"@forestadmin/agent": "^1.8.2",
"@forestadmin/datasource-mongoose": "^1.3.1",
- Recent changes made on your end if any: First deploy to production, migration of the project dimikev_back from old express architecture to new one.