Skip to content

Commit

Permalink
Update AllowOriginMiddleware.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ljwolford committed Mar 21, 2016
1 parent 48f6e5c commit cda5fdf
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions adl_lrs/utils/AllowOriginMiddleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ def process_request(self, request):
return HttpResponse()

def process_response(self, request, response):
protocol = 'https' if request.is_secure() else 'http'
port = None
if 'SERVER_PORT' in request.META:
port = request.META['SERVER_PORT']
response['Access-Control-Allow-Origin'] = "%s://%s:%s" % (protocol, request.META['SERVER_NAME'], port)
else:
response['Access-Control-Allow-Origin'] = "%s://%s" % (protocol, request.META['SERVER_NAME'])
response['Access-Control-Allow-Origin'] = '*'
response['Access-Control-Allow-Methods'] = 'HEAD, POST, GET, OPTIONS, DELETE, PUT'
response['Access-Control-Allow-Headers'] = 'Content-Type,Content-Length,Authorization,If-Match,If-None-Match,X-Experience-API-Version, Accept-Language'
response['Access-Control-Expose-Headers'] = 'ETag,Last-Modified,Cache-Control,Content-Type,Content-Length,WWW-Authenticate,X-Experience-API-Version, Accept-Language'
Expand Down

0 comments on commit cda5fdf

Please sign in to comment.