Skip to content

Commit

Permalink
Fix: CORS issue on notify endpoint
Browse files Browse the repository at this point in the history
Co-authored-by: Andres D. Molins <nesitor@gmail.com>
  • Loading branch information
nesitor and Andres D. Molins authored Jan 26, 2024
1 parent 3f97bf6 commit c171880
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/aleph/vm/orchestrator/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,9 @@ async def notify_allocation(request: web.Request):
except JSONDecodeError as error:
raise web.HTTPBadRequest(reason="Body is not valid JSON") from error
except ValidationError as error:
raise web.json_response(data=error.json(), status=web.HTTPBadRequest.status_code) from error
raise web.json_response(
data=error.json(), status=web.HTTPBadRequest.status_code, headers={"Access-Control-Allow-Origin": "*"}
) from error

pubsub: PubSub = request.app["pubsub"]
pool: VmPool = request.app["vm_pool"]
Expand Down Expand Up @@ -481,4 +483,5 @@ async def notify_allocation(request: web.Request):
"errors": {vm_hash: repr(error) for vm_hash, error in scheduling_errors.items()},
},
status=status_code,
headers={"Access-Control-Allow-Origin": "*"},
)

0 comments on commit c171880

Please sign in to comment.