dotcloud/docker-registry — pull request #338 by abonas (2014-05-05 11:34:05+00:00)
Title: Fix issue #333 - Added CORS support to 'get images' and 'search' methods in registry REST api

This change uses flask_cors lib that adds CORS (Cross-Origin Resource Sharing) support to the following 2 REST api methods of docker-registry: search and 'get images'.

Since those are a GET (read) methods, that are public anyway, the added configuration is (*) - all origins are allowed to retrieve that information.
If someone needs to restrict that access, it can be done by changing configuration (CORS_ORIGINS) as described in flask_cors documentation:
http://flask-cors.readthedocs.org/en/latest/#application-wide-settings

This patch is needed because otherwise some integrations with docker that are made with Ajax will become very problematic due to cross origin limitations, and since the registry is also lacking JSONP support which is another method to solve cross origin issues.

More registry's REST methods can also be enabled for CORS in the future by adding @flask_cors.cross_origin on the relevant methods.