Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A typical configuration for deploying a WSGI application includes a WSGI server (such as uWSGI or Gunicorn) behind a general-purpose web server (like nginx) that acts as a reverse proxy. One major reason I know for having a reverse proxy is to serve static files efficiently. Are there any other reasons?

Suppose my application involves only Python code and doesn’t care about static content. Why would I want the reverse proxy in this case? uWSGI and Gunicorn each already provide an asynchronous HTTP server capable of interfacing with the clients.

Are there any practical cases where I would be better off exposing the WSGI HTTP server directly to the outside world?

share|improve this question
up vote 3 down vote accepted
  • you have more config-options with a full-blown reverse - proxy like

    • rewrite
    • locations
    • server
    • https
    • header-cleanup
    • expires
    • gzip
    • ....
  • you can do loadbalancing

  • you can use proxy_cache
  • you can implement custom error-pages, even when your app-servers are down
  • you can have a WAF implemented
  • you can (sometimes) hotpatch against vulnerabilities


  • you can impress clients with 100.000 requests/second (on average hardware) with the following setup (nginx):


location /perftest/ {
    return 200;
share|improve this answer

Additional Advantages to using a reverse proxy.

Other benefits can be gained that MAY be of benefit to you.

  • You can hide information from the internet (web server version, app server, database server, api)
  • You can implement multiple web server technologies behind one domain (Linux tomcat + Windows IIS etc)
  • You can terminate https/SSL connections and map them to internal http services.
  • You can centralise all logging.
  • You can centralise all DDOS prevention
  • You can Implement identity management from the web server tier.

Security Advantages

  • Internal server hiding as above.
  • You can router/firewall your internal app server servers, and database servers from the internet without resorting to software firewalls on the host (called a DMZ).
  • You can protect a server that is not immediatly fixable from known problems (web application firewall) or known attack patterns.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.