FastAdmin 關於跨域問題解決

來源:互聯網
上載者:User

標籤:cti   not   port   form   param   uri   win   info   跨域問題   

FastAdmin 關於跨域問題解決

之前很久之前收集到社區的問題。
https://forum.fastadmin.net/thread/277

今天又有人問到,無法開啟,估計是網路問題。

以下為完整配置 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 = 'true') {        add_header 'Access-Control-Allow-Origin' "$http_origin" always;        add_header 'Access-Control-Allow-Credentials' 'true' always;        add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;        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;        # required to be able to read Authorization header in frontend        #add_header 'Access-Control-Expose-Headers' 'Authorization' always;}if ($request_method = 'OPTIONS') {        # Tell client that this pre-flight info is valid for 20 days        add_header 'Access-Control-Max-Age' 1728000;        add_header 'Content-Type' 'text/plain charset=UTF-8';        add_header 'Content-Length' 0;        return 204;}
  1. https://gist.github.com/Stanback/7145487?

FastAdmin 關於跨域問題解決

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.