diff --git a/gns3server/web/web_server.py b/gns3server/web/web_server.py index 7e8b56b7..3fb3fdec 100644 --- a/gns3server/web/web_server.py +++ b/gns3server/web/web_server.py @@ -261,15 +261,19 @@ class WebServer: # Background task started with the server self._app.on_startup.append(self._on_startup) + resource_options = aiohttp_cors.ResourceOptions( + expose_headers="*", allow_headers="*", max_age=0 + ) + # Allow CORS for this domains cors = aiohttp_cors.setup(self._app, defaults={ # Default web server for web gui dev - "http://127.0.0.1:8080": aiohttp_cors.ResourceOptions(expose_headers="*", allow_headers="*"), - "http://localhost:8080": aiohttp_cors.ResourceOptions(expose_headers="*", allow_headers="*"), - "http://127.0.0.1:4200": aiohttp_cors.ResourceOptions(expose_headers="*", allow_headers="*"), - "http://localhost:4200": aiohttp_cors.ResourceOptions(expose_headers="*", allow_headers="*"), - "http://gns3.github.io": aiohttp_cors.ResourceOptions(expose_headers="*", allow_headers="*"), - "https://gns3.github.io": aiohttp_cors.ResourceOptions(expose_headers="*", allow_headers="*") + "http://127.0.0.1:8080": resource_options, + "http://localhost:8080": resource_options, + "http://127.0.0.1:4200": resource_options, + "http://localhost:4200": resource_options, + "http://gns3.github.io": resource_options, + "https://gns3.github.io": resource_options }) PortManager.instance().console_host = self._host