diff --git a/homeassistant/components/http/__init__.py b/homeassistant/components/http/__init__.py index d43ba989f28..02b9affefd4 100644 --- a/homeassistant/components/http/__init__.py +++ b/homeassistant/components/http/__init__.py @@ -25,8 +25,7 @@ from .auth import setup_auth from .ban import setup_bans from .cors import setup_cors from .real_ip import setup_real_ip -from .static import ( - CachingFileResponse, CachingStaticResource, staticresource_middleware) +from .static import CachingFileResponse, CachingStaticResource # Import as alias from .const import KEY_AUTHENTICATED, KEY_REAL_IP # noqa @@ -192,8 +191,7 @@ class HomeAssistantHTTP: use_x_forwarded_for, trusted_proxies, trusted_networks, login_threshold, is_ban_enabled, ssl_profile): """Initialize the HTTP Home Assistant server.""" - app = self.app = web.Application( - middlewares=[staticresource_middleware]) + app = self.app = web.Application(middlewares=[]) # This order matters setup_real_ip(app, use_x_forwarded_for, trusted_proxies) diff --git a/homeassistant/components/http/static.py b/homeassistant/components/http/static.py index 8b28a7cf288..54e72c88ff3 100644 --- a/homeassistant/components/http/static.py +++ b/homeassistant/components/http/static.py @@ -1,15 +1,10 @@ """Static file handling for HTTP component.""" - -import re - from aiohttp import hdrs -from aiohttp.web import FileResponse, middleware +from aiohttp.web import FileResponse from aiohttp.web_exceptions import HTTPNotFound from aiohttp.web_urldispatcher import StaticResource from yarl import URL -_FINGERPRINT = re.compile(r'^(.+)-[a-z0-9]{32}\.(\w+)$', re.IGNORECASE) - class CachingStaticResource(StaticResource): """Static Resource handler that will add cache headers.""" @@ -56,19 +51,3 @@ class CachingFileResponse(FileResponse): # Overwriting like this because __init__ can change implementation. self._sendfile = sendfile - - -@middleware -async def staticresource_middleware(request, handler): - """Middleware to strip out fingerprint from fingerprinted assets.""" - path = request.path - if not path.startswith('/static/') and not path.startswith('/frontend'): - return await handler(request) - - fingerprinted = _FINGERPRINT.match(request.match_info['filename']) - - if fingerprinted: - request.match_info['filename'] = \ - '{}.{}'.format(*fingerprinted.groups()) - - return await handler(request)