GithubHelp home page GithubHelp logo

drf-reverse-proxy's Introduction

drf-reverse-proxy

pypi-version build-status-image

Overview

This is a Django REST Framework port of the excellent django-revproxy (https://github.com/TracyWebTech/django-revproxy) library.

This port allows you to reverse proxy HTTP requests while still utilizing DRF features such as authentication, permissions and throttling.

This library works exactly like the django-revproxy library, the documentation for django-revproxy can be found at: http://django-revproxy.readthedocs.org/

Features

  • Proxies all HTTP methods: HEAD, GET, POST, PUT, DELETE, OPTIONS, TRACE, CONNECT and PATCH
  • Copy all http headers sent from the client to the proxied server
  • Copy all http headers sent from the proxied server to the client (except hop-by-hop <http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.1>_)
  • Basic URL rewrite
  • Handles redirects
  • Few external dependencies
  • Maintains the usability of DRF features like authentication, permissions and throttling.

Requirements

  • Python (2.7, 3.3, 3.4, 3.5)
  • Django (1.8, 1.9, 1.10)
  • Django REST Framework (3.3, 3.4, 3.5)

Installation

Install using pip\ โ€ฆ

$ pip install drf-reverse-proxy

Example

Create a custom reverse proxy view:

from drfreverseproxy import ProxyView

class TestProxyView(ProxyView):
   upstream = 'http://example.com'

Or just use the default:

from drfreverseproxy import ProxyView

urlpatterns = [
   url(r'^(?P<path>.*)$', ProxyView.as_view(upstream='http://example.com/')),
]

drf-reverse-proxy's People

Contributors

7tg avatar danpoland avatar dependabot[bot] avatar fabianhoward avatar oligond avatar rooterkyberian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

drf-reverse-proxy's Issues

Fix outdated urllib3 dependency

drf-reverse-proxy is currently suffering from the same issue that is already documented in django-revproxy issue #75 as well as requests issue #4010.
As I'm lacking resources currently to dive deeper into the code but would like to use drf-reverse-proxy without being stuck with urllib 1.16, I propose to adapt the solution outlined in the above mentioned requests issue and just add request_context as an additional parameter to the _new_pool method signature (without doing any further processing on it). This solution was also adapted by the django-revproxy contributors.
I'll send a PR for this shortly.

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.