Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update <link> static assets to use the new domain #8916

Merged
merged 8 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ We have linting with the [Airbnb styleguide](https://github.com/airbnb/javascrip

We have [Jest](https://facebook.github.io/jest) unit tests that can be run with `yarn test:unit`.

`npm test` runs both sets of these.
`yarn test` runs both sets of these.

### End-to-end tests

Expand Down
26 changes: 13 additions & 13 deletions src/app/containers/Metadata/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,47 +183,47 @@ it('should render the apple touch icons', async () => {
},
{
href:
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-72x72.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-72x72.png',
sizes: '72x72',
},
{
href:
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-96x96.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-96x96.png',
sizes: '96x96',
},
{
href:
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-128x128.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-128x128.png',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache-control header max-age is different
Old endpoint:
curl -Is https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-128x128.png
cache-control: max-age=31622400 (366 days)

New endpoint:
curl -Is https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-128x128.png
cache-control: max-age=604800 (7 days)
and a new header:
strict-transport-security: max-age=2592000

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache control change is I think deliberate - we didn't want so long on the new one so that we can more easily update the images, and settled on seven days as reasonably short without being too short.

I don't know about the other one, but maybe @chris-hinds or @jamesdonoh do?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. To enable updates to logo files, I'd suggest a better model would be to include a hash of the file content in the filename and keep a long cache-control max-age.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks.

Given this PR is just updating this URL to be consistent with the ones already in the manifest files, would it be okay to proceed with this as is, and I can write a new issue to cover considering the caching approaches?

cc @joshcoventry

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So long as the team is happy with the cache hit going from 366 days to 7, sure.
Regarding the new header strict-transport-security: max-age=2592000 (30 days) - this tells the browser to use HTTPS instead of HTTP for 30 days. This could also be extended to 366 days, since I don't believe this is expected to change.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache control change is I think deliberate - we didn't want so long on the new one so that we can more easily update the images, and settled on seven days as reasonably short without being too short.

I don't know about the other one, but maybe @chris-hinds or @jamesdonoh do?

Apologies have only just seen this. Yes the cache changes were deliberate to ensure that we have a reasonable cache time but are able to still update the images.

Setting a hash in the url is a good idea but something we'd have to work on when the team has more time.

Regarding setting strict-transport-security we should work with the Mozart team on this and perhaps this is a default header that should be applied if it isn't already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per what Chris has said, happy for this PR to go out as is - we can pick up other work relating to the cache afterwards.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've drafted an issue here for the caching stuff: #8931

sizes: '128x128',
},
{
href:
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-144x144.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-144x144.png',
sizes: '144x144',
},
{
href:
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-152x152.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-152x152.png',
sizes: '152x152',
},
{
href:
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-180x180.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-180x180.png',
sizes: '180x180',
},
{
href:
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-192x192.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-192x192.png',
sizes: '192x192',
},
{
href:
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-384x384.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-384x384.png',
sizes: '384x384',
},
{
href:
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-512x512.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-512x512.png',
sizes: '512x512',
},
];
Expand All @@ -246,19 +246,19 @@ it('should render the icons', async () => {
const expected = [
{
href:
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-72x72.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-72x72.png',
sizes: '72x72',
type: 'image/png',
},
{
href:
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-96x96.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-96x96.png',
sizes: '96x96',
type: 'image/png',
},
{
href:
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-192x192.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-192x192.png',
sizes: '192x192',
type: 'image/png',
},
Expand Down Expand Up @@ -417,7 +417,7 @@ it('should render the msapplication meta tags', async () => {

expect(tileColour).toEqual('#B80000');
expect(tileImage).toEqual(
'https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-144x144.png',
'https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-144x144.png',
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/containers/Metadata/utils.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';

export const getIconAssetUrl = (service, size) =>
`https://news.files.bbci.co.uk/include/articles/public/${service}/images/icons/icon-${size}.png`;
`https://static.files.bbci.co.uk/ws/simorgh-assets/public/${service}/images/icons/icon-${size}.png`;

const createIconLinks = (service, iconSizes, iconType) => {
return iconSizes.map(size => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,63 +272,63 @@ Object {
exports[`AMP Articles SEO Apple Touch Icon should match attributes 2`] = `
Object {
"sizes": "72x72",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-72x72.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-72x72.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 3`] = `
Object {
"sizes": "96x96",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-96x96.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-96x96.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 4`] = `
Object {
"sizes": "128x128",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-128x128.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-128x128.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 5`] = `
Object {
"sizes": "144x144",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-144x144.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-144x144.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 6`] = `
Object {
"sizes": "152x152",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-152x152.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-152x152.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 7`] = `
Object {
"sizes": "180x180",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-180x180.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-180x180.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 8`] = `
Object {
"sizes": "192x192",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-192x192.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-192x192.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 9`] = `
Object {
"sizes": "384x384",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-384x384.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-384x384.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 10`] = `
Object {
"sizes": "512x512",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-512x512.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-512x512.png",
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,63 +181,63 @@ Object {
exports[`Canonical Articles SEO Apple Touch Icon should match attributes 2`] = `
Object {
"sizes": "72x72",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-72x72.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-72x72.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 3`] = `
Object {
"sizes": "96x96",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-96x96.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-96x96.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 4`] = `
Object {
"sizes": "128x128",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-128x128.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-128x128.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 5`] = `
Object {
"sizes": "144x144",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-144x144.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-144x144.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 6`] = `
Object {
"sizes": "152x152",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-152x152.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-152x152.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 7`] = `
Object {
"sizes": "180x180",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-180x180.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-180x180.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 8`] = `
Object {
"sizes": "192x192",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-192x192.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-192x192.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 9`] = `
Object {
"sizes": "384x384",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-384x384.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-384x384.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 10`] = `
Object {
"sizes": "512x512",
"url": "https://news.files.bbci.co.uk/include/articles/public/news/images/icons/icon-512x512.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/news/images/icons/icon-512x512.png",
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,63 +286,63 @@ Object {
exports[`AMP Articles SEO Apple Touch Icon should match attributes 2`] = `
Object {
"sizes": "72x72",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-72x72.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-72x72.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 3`] = `
Object {
"sizes": "96x96",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-96x96.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-96x96.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 4`] = `
Object {
"sizes": "128x128",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-128x128.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-128x128.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 5`] = `
Object {
"sizes": "144x144",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-144x144.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-144x144.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 6`] = `
Object {
"sizes": "152x152",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-152x152.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-152x152.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 7`] = `
Object {
"sizes": "180x180",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-180x180.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-180x180.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 8`] = `
Object {
"sizes": "192x192",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-192x192.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-192x192.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 9`] = `
Object {
"sizes": "384x384",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-384x384.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-384x384.png",
}
`;

exports[`AMP Articles SEO Apple Touch Icon should match attributes 10`] = `
Object {
"sizes": "512x512",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-512x512.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-512x512.png",
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,63 +195,63 @@ Object {
exports[`Canonical Articles SEO Apple Touch Icon should match attributes 2`] = `
Object {
"sizes": "72x72",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-72x72.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-72x72.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 3`] = `
Object {
"sizes": "96x96",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-96x96.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-96x96.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 4`] = `
Object {
"sizes": "128x128",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-128x128.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-128x128.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 5`] = `
Object {
"sizes": "144x144",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-144x144.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-144x144.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 6`] = `
Object {
"sizes": "152x152",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-152x152.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-152x152.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 7`] = `
Object {
"sizes": "180x180",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-180x180.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-180x180.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 8`] = `
Object {
"sizes": "192x192",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-192x192.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-192x192.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 9`] = `
Object {
"sizes": "384x384",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-384x384.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-384x384.png",
}
`;

exports[`Canonical Articles SEO Apple Touch Icon should match attributes 10`] = `
Object {
"sizes": "512x512",
"url": "https://news.files.bbci.co.uk/include/articles/public/persian/images/icons/icon-512x512.png",
"url": "https://static.files.bbci.co.uk/ws/simorgh-assets/public/persian/images/icons/icon-512x512.png",
}
`;

Expand Down
Loading