Here is a detailed explanation of my tests.
Modifying /etc/hosts
I added the following entries to my /etc/hosts
file:
127.0.0.1 auth.domain.test
127.0.0.1 app.domain.test
Nginx Proxy Configuration
Authentication Service
server {
listen 443;
server_name auth.domain.test;
ssl_certificate /etc/nginx/conf.d/ssl/localhost.crt;
ssl_certificate_key /etc/nginx/conf.d/ssl/localhost.key;
location / {
proxy_pass http://EC2-instance-IP:9011;
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;
proxy_set_header "X-Forwarded-Port" "80";
proxy_http_version 1.1;
}
}
Application Service
server {
listen 443;
server_name app.domain.test;
ssl_certificate /etc/nginx/conf.d/ssl/localhost.crt;
ssl_certificate_key /etc/nginx/conf.d/ssl/localhost.key;
location / {
proxy_pass http://app-container:4200;
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;
}
}
Testing Different TLDs
I then replaced the .test
TLD with several alternatives to determine which ones worked in this local setup. The tested TLDs and their outcomes are summarized in the table below:
TLD | Result |
---|---|
.local |
Failed |
.test |
Failed |
.internal |
Failed |
.net |
Succeeded |
.org |
Succeeded |
.com |
Succeeded |
Nothing changed in all the tests except the TLDs, so I doubt it's an issue with the proxy.
We deciced to use .net for our local dev env and this working fine now for all our develpers.