nginx 解決圖片跨域問題
server {
listen 80;
server_name static.xx.com;
location ~* \.(html|htm|shtml|zip|rar|doc|docx|xls|xlsx|ppt|ppts|gif|jpg|jpeg|png|bmp|swf|ico|js|css)$ {
root /data/htdocs/xx;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
}
重點是新增
標註的紅色區域就是解決圖片跨域訪問如下
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
相關文章
- 二進位制函式JSON資料分類問題——機器學習
- h5單頁面彈出彈窗背景滾動問題
- sqlserver的waitresource等待事件是linked server連結伺服器的問題
- Docker構建的tomcat工程上傳檔案,訪問報403許可權問題
- 整理jquery中的switch用法及注意問題
- Python:圖片合視訊(最簡)
- dubbo繼承springboot出現的問題
- react native ScrollView巢狀WebView 互動問題
- vue 中引用echarts 初始化init undefind問題(Cannot read property ‘init‘ of undefined)
- MATLAB將figure視窗儲存為圖片
- kafka 消費組功能驗證以及消費者資料重複資料丟失問題說明 3
- 基於centOS的dvwa只能ping通127.0.0.1的問題
- 用 Httprunner3 做介面測試遇到了問題,.with_json 的引數是列表時報錯
- Spring Cloud Gateway + oauth2 跨域配置實現
- Stream中filter過濾條件問題記錄
- 18、繼承以及繼承中成員變數和成員方法的重名問題
- VUE 呼叫 flask 介面,解決跨域問題