快捷搜索:   nginx

Nginx反代Cloudflare API接口实现前端跨域提交

对于有前端提交数据操作cloudflare API的,可以考虑用nginx反代,用来解决跨域提交数据问题

反代代码如下:

#添加请求头 add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Headers' '*'; add_header 'Access-Control-Allow-Methods' '*'; #反代配置 location /client/v4 {    proxy_pass https://api.cloudflare.com;    proxy_set_header Host api.cloudflare.com;    proxy_ssl_server_name on;    proxy_ssl_name api.cloudflare.com;    proxy_set_header X-Real-IP $remote_addr;    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    proxy_set_header REMOTE-HOST $remote_addr; }

顶(0)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论