I’m encountering an issue with my application setup. I’ve configured a frontend and a backend API using Docker Compose. However, I recently needed to implement SSL, so I installed Nginx on the host machine and set up a reverse proxy. Despite this, I’m facing difficulties getting the backend to function, although the frontend is operational.
Accessing the frontend works, but when trying to login it says 404 not found on the backend path.
here is the error
here is my nginx config
server {
listen 443 ssl;
server_name custom.domain.com www.custom.domain.com;
ssl_certificate /etc/certs/custom.domain.crt;
ssl_certificate_key /etc/certs/custom.domain.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
proxy_pass http://localhost:3000; # Forward requests to your frontend
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;
}
location /api/ {
proxy_pass http://localhost:8080/; # Forward requests to your backend
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;
}
location = /favicon.ico {
return 204;
access_log off;
log_not_found off;
}
}
Note: if I try to access the backend via postman using http://custom.domain.com:8080/api/auth/login it is working, however it is not working with https://custom.domain/api/auth/login
any help would be much appreciated.