Express + CloudFlare with SSL

大兔子大兔子 提交于 2021-01-29 08:02:18

问题


I have an express app freshly created using express appName. I've changed the port to 443. The domain is under CloudFlare's proxy with SSL enabled. When I go to the website though, I get the CloudFlare page Web server is down instead of seeing the express index page.

How can I make Express work with CloudFlare's SSL?


回答1:


There are two options:

  • You need to alter your app such that it is able to accept HTTPS connections instead of HTTP. You can do this by using the HTTPS library instead of HTTP.
  • You can switch to Flexible SSL instead of Full, but this is not recommended for a lot of applications as it means the connection from Cloudflare's Edge to your Origin is unencrypted.


来源:https://stackoverflow.com/questions/40767038/express-cloudflare-with-ssl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!