Code Monkey home page Code Monkey logo

kong-referer-restriction's Introduction

kong-referer-restriction

A Kong plugin that allows restriction of request based on their referer header. This could be useful e.g. to prevent "hotlinked" images.

Installation

Run:

luarocks install *.rockspec

Then in the kong.yml add

custom_plugins:
  - kong-referer-restriction

Run kong reload or start and add the plugin as normal.

Docker installation

Derive your kong images FROM kong and add something like

FROM kong

RUN apk update && apk add git
RUN git clone https://github.com/dsteinkopf/kong-referer-restriction
RUN cd kong-referer-restriction && luarocks install *.rockspec

Then put KONG_CUSTOM_PLUGINS: kong-referer-restriction into your environment when starting the kong container.

Info

This plugin's priority is set to 1300. So it is handled after ip-restriction, bot-detection, cors and after kong-http-to-https-redirect - but before jwt and other authentication plugins (see last paragraph in Kongo Plugin Documentation - Custom Logic).

Configuration

  • allowed_referer_patterns:
    • type: list of strings
    • default value: empty
    • example: ^https?://my.nice.site.tld/
    • List of patterns of allowed referer headers (Referer: http://example.org/referring_page). Referer is converted to lower case before matching. Any incoming request must match at least one of the patterns. If no pattern is configured / list is empty then everything is allowed.

Misc

Thanks to the creator of https://github.com/HappyValleyIO/kong-http-to-https-redirect.

kong-referer-restriction's People

Contributors

dsteinkopf avatar crnm21 avatar

Watchers

James Cloos avatar

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.