-
I have two subdomain (dev.domain.com) and (test.domain.com) Both are placed in different folders
AS I see, sometimes (~50%) when i surf on dev.domain.com and call an api request that not exist on test.domain.com i got 404. Because of this i think some times nginx-proxy-automation forward the request to test.domain.com instead of dev.domain.com The other reason why I think it's a forward problem, because if I stop test.domain.com all request successful. I have not found any information about there is a problem with subdomains. Here are some conf: dev.domain.com .env
docker-compose.yml
test.domain.com .env
docker-compose.yml version: '3.8'
services:
#NGINX
nginx:
restart: always
image: nginx:1.19.6-alpine
env_file:
- .env
environment:
BACKEND_PORT: ${SERVER_PORT}
PUBLIC_PORT: ${PUBLIC_PORT}
VIRTUAL_HOST: ${DOMAINS}
VIRTUAL_PORT: ${NGINX_PORT}
LETSENCRYPT_HOST: ${DOMAINS}
volumes:
- ./nginx/prod.default.conf.template:/etc/nginx/templates/default.conf.template
- ./frontend/dist/browser:/usr/share/nginx/html
ports:
- '${NGINX_PORT}:80'
logging:
driver: none
#BACKEND
backend:
build:
dockerfile: Dockerfile
context: ./backend
env_file:
- .env
environment:
MAIL_TO_OAM: ${MAIL_TO_OAM}
MAIL_TO_WEBSITE: ${MAIL_TO_WEBSITE}
MAIL_FROM_WEBSITE: ${MAIL_FROM_WEBSITE}
SMTP_HOST: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT}
SMTP_USER: ${SMTP_USER}
SMTP_SECURE: ${SMTP_SECURE}
SMTP_PASSWORD: ${SMTP_PASSWORD}
MONGO_DB: ${MONGO_DB}
MONGO_PORT: ${MONGO_PORT}
MONGO_HOST: ${MONGO_HOST}
MONGO_USERNAME: ${MONGO_USERNAME}
MONGO_PASSWORD: ${MONGO_PASSWORD}
MONGO_PROTOCOL: ${MONGO_PROTOCOL}
MONGO_AUTHSOURCE: ${MONGO_AUTHSOURCE}
SERVER_HOST: ${SERVER_HOST}
SERVER_PORT: ${SERVER_PORT}
SERVER_PATH: ${SERVER_PATH}
SERVER_ENVIRONMENT: ${SERVER_ENVIRONMENT}
DEBUG_COLORS: "true"
TERM: xterm-256color
COLORTERM: truecolor
volumes:
- ./backend:/app
entrypoint: ["npm", "run", "serve"]
networks:
default:
external:
name: ${NETWORK} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Until now I have made some test and now I see, I was right. So if i have two separated project with subdomains (i have not tested with other domains only with subdomains yet) at VIRTUAL_HOST and LETSENCRYPT_HOST, than the request randomly served between the projects. |
Beta Was this translation helpful? Give feedback.
-
I solved it. The problem was that both subdomain used the same services and the same external network. So the nginx-proxy-automation worked well, that forwarded the request to one of my website (well), but inside it there is an other nginx that also forwarded the request between frontend and backend. And the problem was with this, because the services names where the same, so my internal nginx service sometimes forwarded the request to subdomain1 sometimes subdomain2. I hope this could help for others. |
Beta Was this translation helpful? Give feedback.
I solved it.
The problem was that both subdomain used the same services and the same external network. So the nginx-proxy-automation worked well, that forwarded the request to one of my website (well), but inside it there is an other nginx that also forwarded the request between frontend and backend. And the problem was with this, because the services names where the same, so my internal nginx service sometimes forwarded the request to subdomain1 sometimes subdomain2.
I hope this could help for others.