问题
I am getting a 400 Bad Request error. Sometimes it works, sometimes it doesn't. On the phone it seems to work more often than not. I am not sure what the deal is but it is quite irritating.
server {
listen 80;
listen [::]:80;
server_name url url;
return 301 https://$host$request_uri;
}
server {
# SSL configuration
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name url url;
ssl on;
ssl_certificate /etc/ssl/certs/cert.pem;
ssl_certificate_key /etc/ssl/private/key.pem;
ssl_client_certificate /etc/ssl/certs/cloudflare.crt;
ssl_verify_client on;
location / {
proxy_pass http://localhost:8080;
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;
}
}
回答1:
I also experienced this in one the new websites in my server that uses CloudFlare. The issue was that SSL/TLS > Origin Server > Authenticated Origin Pulls
was not activated by default in the new website that shares server with my other sites which already had Authenticated Origin Pulls activated. So I just had to activate that for the new site. In other peoples' cases, that may be checked if there is a need to deactivate it.
来源:https://stackoverflow.com/questions/55606390/digital-ocean-node-js-nginx-and-cloudflare-400-badrequest-no-required-ssl-cer