Giter Site home page Giter Site logo

referer's Introduction

Referer 防盗链

通过 referer 进行防盗链保护

配置举例

# Static configuration

experimental:
  plugins:
    referer:
        moduleName: github.com/moonlightwatch/referer
        version: v0.1.2
# Dynamic configuration

http:
  routers:
    my-router:
      rule: host(`demo.localhost`)
      service: service-foo
      entryPoints:
        - web
      middlewares:
        - my-plugin

  services:
   service-foo:
      loadBalancer:
        servers:
          - url: http://127.0.0.1:5000
  
  middlewares:
    my-plugin:
      plugin:
        referer:
          Type: white
          EmptyReferer: true
          Domains:
            - "*.baidu.com"
            - "google.com"

说明

Type 字段,可以选填:white 或者 black,分别表示白名单模式和黑名单模式。

白名单模式下:

  1. 匹配 Domains 所载域名的 referer 参数,可以进行访问。
  2. EmptyReferertrue 则允许 referer 为空的请求进行访问。否则,不允许 referer 为空的请求进行访问。

黑名单模式下:

  1. 匹配 Domains 所载域名的 referer 参数,拒绝访问。
  2. EmptyReferertrue 则拒绝 referer 为空的请求进行访问。否则,允许 referer 为空的请求进行访问。

Domains 字段,是一个列表,可以填写域名或者以 * 为通配符的子域名。

referer's People

Contributors

moonlightwatch avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

enigmacurry

referer's Issues

Please add a LICENSE.txt

Can you please release this as open source under the MIT License (or any other open source license you prefer) by adding a LICENSE.txt file? Thank you!

[Traefik Plugin Catalog] Plugin Analyzer has detected a problem.

The plugin was not imported into Traefik Plugin Catalog.

Cause:

the import "github.com/moonlightwatch/referer" must be related to the module name "referer"

Traefik Plugin Analyzer will restart when you will close this issue.

If you believe there is a problem with the Analyzer or this issue is the result of a false positive, please contact us.

[Traefik Plugin Catalog] Plugin Analyzer has detected a problem.

The plugin was not imported into Traefik Plugin Catalog.

Cause:

the import "github.com/moonlightwatch/referer" must be related to the module name "referer"

Traefik Plugin Analyzer will restart when you will close this issue.

If you believe there is a problem with the Analyzer or this issue is the result of a false positive, please contact us.

[Traefik Plugin Catalog] Plugin Analyzer has detected a problem.

The plugin was not imported into Traefik Plugin Catalog.

Cause:

the import "github.com/moonlightwatch/referer" must be related to the module name "referer"

Traefik Plugin Analyzer will restart when you will close this issue.

If you believe there is a problem with the Analyzer or this issue is the result of a false positive, please contact us.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.