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

        }
    }
	
}

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

相关推荐
kc胡聪聪26 分钟前
nginx的核心功能
服务器·nginx
sbjdhjd26 分钟前
RHCE | Web 服务器与 Nginx 全栈详解
linux·nginx·http·云原生·oracle·架构·web
执笔为剑1 小时前
1.2、docker环境部署
运维·docker·容器
White-Legend1 小时前
免费额度每日20刀Codex GPT 5.4分享
gpt·ai编程
卢傢蕊1 小时前
LNAMP 网站架构与部署
运维·nginx·lamp
gbling2 小时前
网页多次重定向问题
运维·nginx
春日见3 小时前
端到端大模型自动驾驶
java·开发语言·驱动开发·docker·自动驾驶·计算机外设
中国IT3 小时前
第3章:Docker与传统虚拟化比较
运维·docker·容器
洛菡夕3 小时前
nginx核心功能
linux·nginx
淡泊if3 小时前
eBPF 实战:一次诡异的 Nginx 高延迟,我用 5 分钟在内核里找到了真凶
java·运维·nginx·微服务·ebpf