Nginx配置服務器靜態文件支持跨域訪問


在server中配置
add_header Access-Control-Allow-Origin *;

add_header Access-Control-Allow-Headers X-Requested-With;

add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
Apache支持跨域
    ServerName www.statics.xxx.io

    DocumentRoot E:/project/xxx/statics

    Header set Access-Control-Allow-Origin *

    Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"

    Header set Access-Control-Allow-Headers "Content-Type"

    Options +Indexes +Includes +FollowSymLinks +MultiViews

    AllowOverride All

    Require local


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM