要调用成功,需要Gateway能联通这些注册到nacos的实际IP+端口
nginx反向代理跨域可参考这个配置
location /api { # 隐藏后端返回的 CORS 头部 proxy_hide_header 'Access-Control-Allow-Origin'; proxy_hide_header 'Access-Control-Allow-Methods'; proxy_hide_header 'Access-Control-Allow-Headers'; proxy_hide_header 'Access-Control-Allow-Credentials'; proxy_hide_header 'Access-Control-Expose-Headers'; proxy_hide_header 'Access-Control-Max-Age'; # 所有非OPTIONS请求的CORS头部 add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; add_header 'Access-Control-Allow-Headers' 'DNT,X-Requested-With,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,token,Blade-Auth,Blade-Requested-With,Tenant-Id' always; add_header 'Access-Control-Allow-Credentials' 'true' always; add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; # 处理OPTIONS预检请求 if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; add_header 'Access-Control-Allow-Headers' 'DNT,X-Requested-With,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,token,Blade-Auth,Blade-Requested-With,Tenant-Id' always; add_header 'Access-Control-Max-Age' 3600; # 预检请求的缓存时间 add_header 'Content-Length' 0; add_header 'Content-Type' 'text/plain charset=UTF-8'; return 204; # 返回204响应,表示成功,但不返回数据 } # 原来的代理配置 proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8800/; }
讨论(1)
- 热议问题
-
4.6.0bladex-boot启动差表act_ge_property
1
-
avue3 富文本上传图片
1
-
表单设计,请求地址如何动态拼接参数
2
-
项目启动相关
1
-
短信配置
1
-
springboot 通过http获取jar包内静态文件报404
1
-
更换模型APIkey不生效的问题
1
-
Blade AI 大模型接入协议
1
-
代码生成主子表有bug
1
-
你好,现在docker镜像拉不下来了, 针对bladex的部署,还能用docker吗,该怎么拉部署的镜像
1
扫一扫访问 Blade技术社区 移动端