Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

pypm install wsgicors

How to install wsgicors

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install wsgicors
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
0.2 Available View build log
Linux (64-bit)
0.2 Available View build log
Apache Software License 2.0
Lastest release
version 0.2 on Mar 2nd, 2013


This is a WSGI middleware that answers CORS preflight requests and adds the needed header to the response. For CORS see: http://www.w3.org/TR/cors/


Either plug it in programmatically as in this pyramid example:

def app(global_config, **settings):
    """ This function returns a WSGI application.

    It is usually called by the PasteDeploy framework during
    ``paster serve``.

    def get_root(request):
        return {}

    config = Configurator(root_factory=get_root, settings=settings)
    # whatever it takes to config your app goes here

    from wsgicors import CORS
    return CORS(config.make_wsgi_app(), headers="*", methods="*", maxage="180", origin="*")

or plug it into your wsgi pipeline via paste ini to let it serve by waitress for instance:

use = egg:mysuperapp#app

# wsgi server configuration

use = egg:waitress#main
host =
port = 6543

pipeline =

use = egg:wsgicors#middleware

Keywords are:

  • origin
  • headers
  • methods
  • credentials
  • maxage

for origin:

  • use copy which will copy whatever origin the request comes from
  • any other literal will be be copied verbatim (like * for instance to allow every source)

for headers:

  • use * which will allow whatever header is asked for
  • any other literal will be be copied verbatim (like * for instance to allow every source)

for methods:

  • use * which will allow whatever method is asked for
  • any other literal will be be copied verbatim (like POST, PATCH, PUT, DELETE for instance)

for credentials:

  • use true
  • anything else will be ignored (that is no response header for Access-Control-Allow-Credentials is sent)

for maxage:

  • give the number of seconds the answer can be used by a client, anything nonempty will be copied verbatim

As can be seen in the example above, a policy needs to be created with the policy keyword. The options need then be prefixed with the policy name and a _.


Version 0.2
  • Access-Control-Allow-Credentials is now returned in the actual reponse if specified by policy

Subscribe to package updates

Last updated Mar 2nd, 2013

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.