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

        }
    }
	
}

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

相关推荐
被瞧不起的神2 小时前
Docker 安装教程(CentOS 系统)纯新手可入门
docker·容器·centos
Thinbug3 小时前
群晖Nas - Docker(ContainerManager)上安装GitLab
docker·容器·gitlab
程序员阿超的博客6 小时前
云原生核心技术 (2/12): Docker 入门指南——什么是容器?为什么它比虚拟机更香?
docker·云原生·容器
Twilight-pending7 小时前
Docker重启流程解析
docker·容器·eureka
测试开发-学习笔记7 小时前
docker的常用命令
docker·容器
Smile_Gently8 小时前
基于服务器使用 apt 安装、配置 Nginx
nginx·ubuntu·debian
慈云数据8 小时前
从零搭建高性能企业级网站:Nginx + PHP-FPM 实战,全程用慈云数据服务器加持
服务器·nginx·php
GeminiJM9 小时前
Spring boot应用监控集成
运维·docker·容器
HGW68910 小时前
为什么已经有 Nginx 了,还需要服务网关?
nginx·spring cloud·微服务·架构