FastAdmin 关于跨域问题解决

FastAdmin 关于跨域问题解决

之前很久之前收集到社区的问题。 https://forum.fastadmin.net/thread/277

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

以下为完整配置 ^1

1# 2# CORS header support 3# 4# One way to use this is by placing it into a file called "cors_support" 5# under your Nginx configuration directory and placing the following 6# statement inside your **location** block(s): 7# 8# include cors_support; 9# 10# As of Nginx 1.7.5, add_header supports an "always" parameter which 11# allows CORS to work if the backend returns 4xx or 5xx status code. 12# 13# For more information on CORS, please see: http://enable-cors.org/ 14# Forked from this Gist: https://gist.github.com/michiel/1064640 15# 16 17set $cors ''; 18if ($http_origin ~ '^https?://(localhost|www\.yourdomain\.com|www\.yourotherdomain\.com)') { 19 set $cors 'true'; 20} 21 22if ($cors = 'true') { 23 add_header 'Access-Control-Allow-Origin' "$http_origin" always; 24 add_header 'Access-Control-Allow-Credentials' 'true' always; 25 add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always; 26 add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With' always; 27 # required to be able to read Authorization header in frontend 28 #add_header 'Access-Control-Expose-Headers' 'Authorization' always; 29} 30 31if ($request_method = 'OPTIONS') { 32 # Tell client that this pre-flight info is valid for 20 days 33 add_header 'Access-Control-Max-Age' 1728000; 34 add_header 'Content-Type' 'text/plain charset=UTF-8'; 35 add_header 'Content-Length' 0; 36 return 204; 37}
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )

Opencv中Mat矩阵相乘——点乘、dot、mul运算详解

Opencv中Mat矩阵相乘——点乘、dot、mul运算详解2016年09月02日00:00:36 \牧野(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fme.csdn.net%2Fdcrmg) 阅读数:59593