I'm using nginx as reverse proxy for my VMs. When I try to authenticate myself in a my website, or in phpmyadmin, nginx return the reponse from the local IP when the POST is from a domain!
Look: Nginx return a local IP instead the domain name
Here i'm trying to authenticate to phpmyadmin. When I valid, I have to refresh the page to connect successfully.
This is my nginx configuration:
server {
listen 80;
server_name mysql.mydomain.com;
location / {
proxy_pass http://10.0.2.103;
}
}
My default file is:
server {
listen 80 default_server;
listen [::]:80 default_server;
location / {
try_files $uri $uri/ =404;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
fastcgi_param REMOTE_ADDR $http_x_real_ip;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
}
# Pour let's encrypt
location '/.well-known/acme-challenge' {
default_type "text/plain";
root /root/certbot-auto/;
}
# On interdit tout autre appel
location ~ /\. {
deny all; access_log off; log_not_found off;
}
}
I'm using CloudFlare for SSL certification. If needed, I can use Let's Encrypt with Nginx. Apache is using for Phpmyadmin, and the other services on other VMs.
I search on internet since yesterday morning, but I didn't found anything about this kind of problem. Do you know what is going wrong ?