swift/doc/source/misc.rst
Scott Simpson 74b27d504d Adding CORS support
Change-Id: I894473994cdfea0996ad16e7619aff421f604abc
2012-10-23 14:48:59 -05:00

4.0 KiB

Misc

Exceptions

swift.common.exceptions

Constraints

swift.common.constraints

Utils

swift.common.utils

TempAuth

swift.common.middleware.tempauth

ACLs

swift.common.middleware.acl

WSGI

swift.common.wsgi

Direct Client

swift.common.direct_client

Internal Client

swift.common.internal_client

Buffered HTTP

swift.common.bufferedhttp

Healthcheck

swift.common.middleware.healthcheck

Recon

swift.common.middleware.recon

MemCacheD

swift.common.memcached

Manager

swift.common.manager

Ratelimit

swift.common.middleware.ratelimit

StaticWeb

swift.common.middleware.staticweb

TempURL

swift.common.middleware.tempurl

FormPost

swift.common.middleware.formpost

Domain Remap

swift.common.middleware.domain_remap

CNAME Lookup

swift.common.middleware.cname_lookup

Proxy Logging

swift.common.middleware.proxy_logging

CORS Headers

Cross Origin RequestS or CORS allows the browser to make requests against Swift from another origin via the browser. This enables the use of HTML5 forms and javascript uploads to swift. The owner of a container can set three headers:

Metadata Use
X-Container-Meta-Access-Control-Allow-Origin Origins to be allowed to make Cross Origin Requests, space separated
X-Container-Meta-Access-Control-Max-Age Max age for the Origin to hold the preflight results.
X-Container-Meta-Access-Control-Allow-Headers Headers to be allowed in actual request by browser.

When the browser does a request it can issue a preflight request. The preflight request is the OPTIONS call that verifies the Origin is allowed to make the request.

  • Browser makes OPTIONS request to Swift
  • Swift returns 200/401 to browser based on allowed origins
  • If 200, browser makes PUT, POST, DELETE, HEAD, GET request to Swift

CORS should be used in conjunction with TempURL and FormPost.