Disable CORS cache, Fixes: #1445

This commit is contained in:
ziajka 2018-11-06 13:31:14 +01:00
parent 2764828f38
commit 78c693ff63

View File

@ -261,15 +261,19 @@ class WebServer:
# Background task started with the server # Background task started with the server
self._app.on_startup.append(self._on_startup) 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 # Allow CORS for this domains
cors = aiohttp_cors.setup(self._app, defaults={ cors = aiohttp_cors.setup(self._app, defaults={
# Default web server for web gui dev # Default web server for web gui dev
"http://127.0.0.1:8080": aiohttp_cors.ResourceOptions(expose_headers="*", allow_headers="*"), "http://127.0.0.1:8080": resource_options,
"http://localhost:8080": aiohttp_cors.ResourceOptions(expose_headers="*", allow_headers="*"), "http://localhost:8080": resource_options,
"http://127.0.0.1:4200": aiohttp_cors.ResourceOptions(expose_headers="*", allow_headers="*"), "http://127.0.0.1:4200": resource_options,
"http://localhost:4200": aiohttp_cors.ResourceOptions(expose_headers="*", allow_headers="*"), "http://localhost:4200": resource_options,
"http://gns3.github.io": aiohttp_cors.ResourceOptions(expose_headers="*", allow_headers="*"), "http://gns3.github.io": resource_options,
"https://gns3.github.io": aiohttp_cors.ResourceOptions(expose_headers="*", allow_headers="*") "https://gns3.github.io": resource_options
}) })
PortManager.instance().console_host = self._host PortManager.instance().console_host = self._host