如何将https提取请求发送到HTTP服务器:混合内容错误

发布于 2025-01-29 16:19:20 字数 740 浏览 1 评论 0原文

我正在使用NextJS应用程序,其中我正在使用简单的获取来发送一些帖子数据。

我们在localhost上使用了应用程序效果很好,但是当我将其放在服务器上时,会出现以下错误。

混合内容:已加载'https://speechwithai.com/home的页面 通过HTTPS,但请求一个不安全的资源 'http://18.224.190.161:5000/filetotext'。这个请求已经 阻塞内容必须通过https提供。

从和到相同的IP地址( https://speechwithai.com/ )。在后面,我在端口80处运行NGINX到Server WebApp,并以5000为Flask REST API。我正在使用烧瓶,因为我需要Python库来处理某些文件。

我尝试了多个帖子,但没有找到任何解决方案。有人可以帮我吗?

我想要的只是向正在运行的烧瓶API服务器发送请求

http:// someipaddress:5000来自 https://mylivenextjsapplication.com

I am using a NextJs app where I am using a simple fetch to send some POST data.

We I used app on localhost it worked fine but when I put it on the server it got following error.

Mixed Content: The page at 'https://speechwithai.com/home' was loaded
over HTTPS, but requested an insecure resource
'http://18.224.190.161:5000/fileToText'. This request has been
blocked; the content must be served over HTTPS.

The from and to are both on same IP address (https://speechwithai.com/). At the back I am running NGINX to server WebAPP at port 80 and Flask REST API at 5000. I am using Flask because I needed python libraries to process some files.

I tried multiple post but I did not find any solution. Could someone please help me?

All I want is to send a request to my FLASK API server which is running

http://someIPAddress:5000 from https://myLiveNextJsApplication.com

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陈甜 2025-02-05 16:19:20

由于这两个服务器都在同一服务器后面运行,并且您已经具有NGINX设置。

按照以下步骤

  1. 设置烧瓶的反向代理
    有像下面的nginx配置之类的东西。
events {}
http {
  server {
    listen 443;
    location /flask_api {
      proxy_pass http://127.0.0.1:5000/;
    }

/etc/nginx/nginx.conf中,

有关更多信息,请访问 https://docs.nginx.com /nginx/admin-guide/web-server/reverse-proxy/

  1. 配置UI以使用此blask_api
    url = https://speechwithai.com/flask_api

  2. 更新烧结路径路由/blask_api

Since both servers are running behind same server and you already have nginx setup.

follow these steps

  1. setup reverse proxy for flask
    with some thing like below
events {}
http {
  server {
    listen 443;
    location /flask_api {
      proxy_pass http://127.0.0.1:5000/;
    }

nginx configuration resides in /etc/nginx/nginx.conf
.
For more information visit https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/

  1. configure ui to use this flask_api
    url = https://speechwithai.com/flask_api

  2. update flask path route to use /flask_api

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文