O frontend abre em https, acessa o backend em my_domain/api/start, mas a resposta não é retornada e há um erro no console:
GET https://my_domain.com:8082/api/start net::ERR_SSL_PROTOCOL_ERROR
Aqui está meu nginx.conf:
server {
listen 80;
server_name my_domain.com www.my_domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name my_domain.com www.my_domain.com;
root /usr/share/nginx/html;
index index.html;
ssl_certificate /etc/nginx/ssl/certificate.crt;
ssl_certificate_key /etc/nginx/ssl/private.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:HIGH:!aNULL:!MD5;
# API Backend proxy
location /api/ {
proxy_pass http://backend:8082;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
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 / {
try_files $uri $uri/ /index.html;
}
error_page 404 /index.html;
}
Minha composição:
services:
frontend:
build:
context: ./frontend
args:
NGINX_CONF: ${NGINX_CONF}
# network_mode: host
# depends_on:
# - backend
ports:
- '80:80'
- "443:443"
volumes:
- ./frontend/ssl:/etc/nginx/ssl
environment:
- ENVIRONMENT=${ENVIRONMENT}
backend:
build:
context: ./backend
args:
CONFIG: ${CONFIG}
ports:
- '8082:8082'
- '8443:8443'
volumes:
- ./frontend/ssl:/etc/nginx/ssl
environment:
- ENVIRONMENT=${ENVIRONMENT}
networks:
app-network:
driver: bridge
curl por http://my_domain:8082/api/start responde normalmente, sem erros. Tentei muitas variantes e nada muda.