fastadmin ajax域名,FastAdmin 关于跨域问题解决(示例代码)

本文介绍了如何解决FastAdmin的跨域问题,提供了完整的Nginx配置示例,包括设置Access-Control-Allow-Origin、Access-Control-Allow-Methods等关键头信息,确保在本地和指定域名下能正常进行AJAX请求。
摘要由CSDN通过智能技术生成

FastAdmin 关于跨域问题解决

今天又有人问到,无法打开,估计是网络问题。

以下为完整配置 1

#

# CORS header support

#

# One way to use this is by placing it into a file called "cors_support"

# under your Nginx configuration directory and placing the following

# statement inside your **location** block(s):

#

# include cors_support;

#

# As of Nginx 1.7.5, add_header supports an "always" parameter which

# allows CORS to work if the backend returns 4xx or 5xx status code.

#

# For more information on CORS, please see: http://enable-cors.org/

# Forked from this Gist: https://gist.github.com/michiel/1064640

#

set $cors '';

if ($http_origin ~ '^https?://(localhost|www.yourdomain.com|www.yourotherdomain.com)') {

set $cors 'true';

}

if ($cors 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值