难以从LightTPD服务器到PM2服务器的HTTP请求

发布于 2025-02-08 02:56:17 字数 815 浏览 4 评论 0原文

背景:

我的个人网站在Raspberry Pi上的LightTPD服务器上运行。我已经转发该服务器的端口(80),因此可以公开访问。

我正在进行一个项目,并且我希望Node.js服务从LightTPD服务器提出请求。我设置了PM2,因此Node.js服务器始终运行。我也转发了该端口(5000)。我已经验证了该服务器正在通过Postman和浏览器

问题工作:

我在提出请求时会收到以下错误:

已被CORS策略阻止:请求客户端不是安全的上下文,并且资源在更私人的地址空间private

值得注意;我有access-control-wall-wall-Private-network:true在响应标头中,访问contect-control-request-request-Provate-network:true在请求标题中。我发现可能解决此问题的唯一其他解决方案是为LightTPD服务器获得SSL证书,并为其使用HTTPS,但是我正在努力设置它是否有效

问题:

    1. 获得LightTPD的SSL证书允许我向我的PM2服务器提出请求吗?
    1. 是否有不同的解决方案?
    1. 此设置有多安全?我期望不多的流量...

Background:

I have my personal website running on a lighttpd server on my raspberry pi. I have that server’s port (80) forwarded so it can be accessed publicly.

I’m in the process of making a project, and I want a node.js service to make requests to from the lighttpd server. I set up pm2 so the node.js server is always running. I have that port forwarded too (5000). I've verified that this server is working via postman and the browser

Problem:

I'm receiving the following error when making requests:

has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space private.

Of note; I have Access-Control-Allow-Private-Network:true in the response header and Access-Control-Request-Private-Network:true in the request header. The only other solution I've found that might fix this is getting an SSL cert for the lighttpd server and using https for it, however I'm struggling setting that up to see if it would work

Questions:

    1. Would getting an SSL cert for lighttpd allow me to make requests to my pm2 server?
    1. Is there a different solution?
    1. How secure is this setup? I don't expect a lot of traffic...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文