Merge pull request #1448 from GNS3/disable-cors-cache

Disable CORS cache, Fixes: #1445
This commit is contained in:
ziajka 2018-11-06 13:38:43 +01:00 committed by GitHub
commit fcd102317a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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