zoukankan      html  css  js  c++  java
  • nginx学习(九):跨域配置和防盗链配置

    本篇文章主要讲解跨域配置和防盗链配置,这里一般知道怎配置就好了,用到的时候直接copy

    跨域设置

    #允许跨域请求的域,*代表所有
    add_header 'Access-Control-Allow-Origin' *;
    #允许带上cookie请求
    add_header 'Access-Control-Allow-Credentials' 'true';
    #允许请求的方法,比如 GET/POST/PUT/DELETE
    add_header 'Access-Control-Allow-Methods' *;
    #允许请求的header
    add_header 'Access-Control-Allow-Headers' *;
    

    防盗链设置

    #对源站点验证
    valid_referers *.kevin.com; 
    #非法引入会进入下方判断
    if ($invalid_referer) {
        return 404;
    } 
    
  • 相关阅读:
    配置文件管理
    Nacos学习
    dockerCompose学习
    Dockerfile
    vue生命周期
    github使用
    推荐系统
    js笔记17
    js笔记16
    js笔记15
  • 原文地址:https://www.cnblogs.com/zhenghengbin/p/12114428.html
Copyright © 2011-2022 走看看