Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit b61de87

Browse files
committed
Merge pull request #338 from abonas/addCORS
Fix issue #333 - Added CORS support to 'get images' and 'search' methods in registry REST api
2 parents af4dc4f + be21b16 commit b61de87

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

docker_registry/index.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22

33
import flask
4+
import flask_cors
45
import simplejson as json
56

67
from . import storage
@@ -106,6 +107,7 @@ def put_repository(namespace, repository, images=False):
106107

107108

108109
@app.route('/v1/repositories/<path:repository>/images', methods=['GET'])
110+
@flask_cors.cross_origin(methods=['GET']) # allow all origins (*)
109111
@toolkit.parse_repository_name
110112
@toolkit.requires_auth
111113
@mirroring.source_lookup(index_route=True)

docker_registry/search.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import flask
2+
import flask_cors
23

34
from .lib import config
45
from .lib import index
@@ -17,6 +18,7 @@
1718

1819

1920
@app.route('/v1/search', methods=['GET'])
21+
@flask_cors.cross_origin(methods=['GET']) # allow all origins (*)
2022
def get_search():
2123
search_term = flask.request.args.get('q', '')
2224
if INDEX is None:

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
boto==2.27.0
22
backports.lzma==0.0.2
33
Flask==0.9
4+
Flask-cors==1.3.0
45
PyYAML==3.10
56
simplejson==3.1.3
67
requests==1.2.0

0 commit comments

Comments
 (0)