Digital Ocean,Node.js,Nginx和Cloudflare(400 badrequest未发送所需的SSL证书) [英] Digital Ocean, Node.js, Nginx and Cloudflare (400 badrequest No required SSL certificate was sent)

查看:560
本文介绍了Digital Ocean,Node.js,Nginx和Cloudflare(400 badrequest未发送所需的SSL证书)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到400错误的请求错误.有时它起作用,有时却不起作用.在电话上,它似乎经常工作.我不确定这笔交易是什么,但这很烦人.

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;
    }
}

推荐答案

我还在我的服务器上使用 CloudFlare的新网站中遇到过这种情况.问题是未激活SSL/TLS > Origin Server > Authenticated Origin Pulls默认情况下,该新网站与已经激活 Authenticated Origin Pulls 的我的其他网站共享服务器.所以我只需要为新站点激活它.在其他人的情况下,可以检查是否需要将其停用.

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.

这篇关于Digital Ocean,Node.js,Nginx和Cloudflare(400 badrequest未发送所需的SSL证书)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆