
1 Chaidu 238 天前 你根本不知道 CORS 是什么意思! |
2 Chaidu 238 天前 以后有问题去问 AI 就行,不要发帖。问题:Nginx 防盗链 |
3 wu00 238 天前 Access-Control-Allow-Origin |
4 wzhaoyang 238 天前 img 、js 不存在跨域 |
5 zx9481 238 天前 location /images/ { valid_referers none blocked www.yourdomain.com yourdomain.com; if ($invalid_referer) { return 403; # 返回 403 Forbidden 错误 # 或者可以重定向到特定的图片或页面 # return 302 http://www.yourdomain.com/blocked.png; } } |
6 paopjian 238 天前 没啥用, 想用你的东西再不行拿反代拉, 你资源真重要就得走登录控制 |
8 hackroad 238 天前 # # Wide-open CORS config for nginx # location / { if ($request_method = 'OPTIONS') { add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS'; # # Custom headers and headers various browsers *should* be OK with but aren't # add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range'; # # 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='; add_header 'Content-Length' 0; return 204; } if ($request_method = 'POST') { add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always; add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; } if ($request_method = 'GET') { add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always; add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always; } } |
9 lisongeee 238 天前 把账号密码私钥给我,我开 ssh 上去免费给你弄 |
10 wangtian2020 238 天前 跨域是指,接口没带 CORS 跨域返回头,你的浏览器认为自己不配访问。postman 调用接口是能拿到东西的。 防盗链是指,NGINX 觉得对方的请求头有问题不配拿到任何东西。 |
12 daimaosix 238 天前 via Android 开 ssh 我上去看看 |
13 EthZhang 237 天前 跨域是针对浏览器的名词,只存在于浏览器,正如上面老哥说的,防盗链一行命令就能加,后端程序里现在也有 CORS 插件很方便就能引入。但也仅仅局限于浏览器, |