GPT访问跨域如何解决呢?

在服务器部署了gpt
参考这个
但是访问不到

后面我在docker启动了nginx代理

bash 复制代码
user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;

    server {
        listen 8899;
        server_name gpt;

        location / {
            add_header Access-Control-Allow-Origin "http://xx.xx.xx.xx:8899"; # 将请求代理到本地的 docker 应用程序运行的端口
            add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
    add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization, X-Requested-With';
    add_header 'Access-Control-Allow-Credentials' 'true';
    if ($request_method = 'OPTIONS') {
        add_header 'Access-Control-Max-Age' 1728000;
        add_header 'Content-Type' 'text/plain charset=UTF-8';
        add_header 'Content-Length' 0;
        return 204;
    }

        }
    }
	
}

还是未能解决这个上述问题,这是为何呢?

相关推荐
正经教主1 小时前
【问题】解决docker的方式安装n8n,找不到docker.n8n.io/n8nio/n8n:latest镜像的问题
运维·docker·容器·n8n
joker_zsl2 小时前
docker的安装和简单使用(ubuntu环境)
运维·docker·容器
啥都想学的又啥都不会的研究生3 小时前
Kubernetes in action-初相识
java·docker·微服务·容器·kubernetes·etcd·kubelet
赵我说的做_life4 小时前
基于Docker的Flask项目部署完整指南
docker·容器·flask
江畔独步5 小时前
docker容器监控&自动恢复
docker·容器·eureka
fxshy5 小时前
ai聊天流式响应,阻塞式和流式响应 nginx遇到的坑
运维·javascript·nginx
MonkeyKing_sunyuhua7 小时前
2.2 主流大模型架构:GPT、DeepSeek、GLM、Claude、QwQ、Qwen2.5-Max等模型的比较与应用场景
gpt·架构
@PHARAOH8 小时前
HOW - 如何模拟实现 gpt 展示答案的交互效果
gpt·交互
诡异森林。10 小时前
Docker--Docker网络原理
网络·docker·容器
ALex_zry11 小时前
Docker Macvlan网络配置实战:解决“network already exists“错误
网络·docker·php