Skip to content

High speed proxy engine to serve light weight content

License

Notifications You must be signed in to change notification settings

thevickypedia/PyProxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyProxy

High speed proxy engine to serve light weight content

Environment Variables

Env vars can either be loaded from .env files.

Env Requirements
  • proxy_host str - Hostname/IP for the proxy server. Defaults to socket.gethostbyname('localhost')
  • proxy_port int - Port number for the proxy server. Defaults to 8000
  • async_proxy bool - Enables asynchronous requests to the client. Defaults to False
  • client_host str - Hostname of the client server. Defaults to None
  • client_ip IPv4Address - IP address of the client server. Defaults to None
  • client_port int - Port number of the client server. Defaults to None
  • client_url HttpUrl - Direct URL to the client server. Defaults to None
  • allowed_headers List[str] - Headers to allow via CORS. Defaults to *
  • allowed_origins List[str] - Origins to allow connections through proxy server and CORS. Defaults to host
  • allowed_methods List[str] - HTTP methods to allow through proxy server. Defaults to ["GET", "POST"]
  • rate_limit Dict/List[Dict] with the rate limit for the proxy server. Defaults to None
  • remove_headers List[str] - Client headers that has to be removed before rendering the response.
  • add_headers List[Dict[str, str]] - Headers to be added before rendering the response.

add_headers and remove_headers are executed ONLY after the response is received from the client. This will NOT alter any transaction between pyproxy and the client.


PyProxy may increase an inconspicuous latency to the connections, but due to asynchronous functionality, it is hardly noticeable.
The proxy server is designed to be lightweight and efficient, however streaming large video files may increase the memory usage at server side, due to multi-layered buffering.

While CORS may solve the purpose at the webpage level, the built-in proxy's firewall restricts connections from any origin regardless of the tool used to connect (PostMan, curl, wget etc.)

Due to this behavior, please make sure to specify ALL the origins that are supposed to be allowed (including but not limited to reverse-proxy, CDN, redirect servers etc.)

The built-in proxy service allows you to implement a rate limiter.

Rate limiting allows you to prevent DDoS attacks and maintain server stability and performance.

Coding Standards

Docstring format: Google
Styling conventions: PEP 8 and isort

Linting

pre-commit is used to ensure linting.

pre-commit run --all-files

License & copyright

© Vignesh Rao

Licensed under the MIT License

About

High speed proxy engine to serve light weight content

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages