Quantcast
Channel: Nginx Forum - Other discussion
Viewing all articles
Browse latest Browse all 972

HTTP 400 error on reverse prxy

$
0
0
Hello all,

I get an 400 error when i try to forward ssl traffic from my subdomain to my docker container on the same machine.

My conf file in nginx:


server {
large_client_header_buffers 4 64k;
if ($host = sub.domain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot


error_log /var/log/nginx/logging/80.log debug;
listen 80;
listen [::]:80;
server_name sub.domain.com;
return 301 https://$host$request_uri;


}

server {
keepalive_timeout 60;
error_log /var/log/nginx/logging/443.log debug;
listen 443 ssl;
listen [::]:443 ssl;
server_name sub.domain.com;
ssl_certificate /etc/letsencrypt/live/sub.domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/sub.domain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
ssl_session_cache shared:TLSSSL:16m;


location / {
proxy_pass http://172.17.0.2:8080;
proxy_set_header Host $http_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 "https";
proxy_read_timeout 90;

}

}

The sub.domain.com is forwaded with an a-record to the server of my public ubuntu server.
When i try sub.domain.com it shows a valid certificate, but with the 400 server error.

There are no errors in my Nginx error log.
In the 443.log i can see the error for the 400 status:

2024/01/04 10:46:50 [debug] 339772#339772: *3350 http proxy status 400 "400 Bad Request"
2024/01/04 10:46:50 [debug] 339772#339772: *3350 http proxy header: "Date: Thu, 04 Jan 2024 10:46:50 GMT"
2024/01/04 10:46:50 [debug] 339772#339772: *3350 http proxy header: "Connection: close"

When i curl to http://172.17.0.2:8080 i get a valid reponse. Firewall is completly disabled.

Hoping somebody can point me to the right direction for fixing this.

Thanks in advance.

Viewing all articles
Browse latest Browse all 972

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>