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

        }
    }
	
}

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

相关推荐
BullSmall16 小时前
第三方软件安全-Dependency‑Track Docker 部署
安全·docker·容器
harmony&17 小时前
Docker 容器技术从入门到实战:容器、网络、存储与监控全解析
docker·云原生
IT大白鼠20 小时前
Docker 私有仓库管理:Harbor 企业级仓库搭建与镜像全生命周期管理
运维·docker·容器
姚不倒21 小时前
Nginx 反向代理:5 种负载均衡策略与实战
运维·nginx·负载均衡
Achieve前端实验室1 天前
SSG 预渲染工具站 SEO 优化实践:从零收录到全面修复的 7 个问题
nginx·seo·前端工程化
bgy66661 天前
从零上手 Docker,容器技术完整入门指南
运维·docker·容器
奇牙coding1231 天前
gpt-5.6-sol 调用一直 429 但 gpt-5.5 完全正常怎么办?排查思路与三种应对方案
gpt·ai
姚不倒1 天前
Nginx 虚拟主机:server_name 匹配规则与实战
运维·nginx
hoho_121 天前
麒麟V10升级nginx最新版本到1.31.4
java·服务器·nginx
姚不倒1 天前
Nginx 核心架构:Master-Worker、epoll、热重载深度解析
运维·nginx·架构