mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-28 01:50:12 -04:00
Merge pull request #3729 from alphagov/add-preconnect-header
Tell browser to connect to asset domain earlier
This commit is contained in:
@@ -630,6 +630,11 @@ def useful_headers_after_request(response):
|
||||
logo_domain=get_logo_cdn_domain(),
|
||||
)
|
||||
))
|
||||
response.headers.add('Link', (
|
||||
'<{asset_url}>; rel=dns-prefetch, <{asset_url}>; rel=preconnect'.format(
|
||||
asset_url=f'https://{current_app.config["ASSET_DOMAIN"]}'
|
||||
)
|
||||
))
|
||||
if 'Cache-Control' in response.headers:
|
||||
del response.headers['Cache-Control']
|
||||
response.headers.add(
|
||||
|
||||
@@ -24,6 +24,10 @@ def test_owasp_useful_headers_set(
|
||||
" *.notifications.service.gov.uk static-logos.test.com data:;"
|
||||
"frame-src 'self' www.youtube-nocookie.com;"
|
||||
)
|
||||
assert response.headers['Link'] == (
|
||||
'<https://static.example.com>; rel=dns-prefetch, '
|
||||
'<https://static.example.com>; rel=preconnect'
|
||||
)
|
||||
|
||||
|
||||
def test_headers_non_ascii_characters_are_replaced(
|
||||
|
||||
Reference in New Issue
Block a user