No description
Find a file
Joachim Viide d670198e7c
Add "Vary: Accept" header to /_next/image responses (#26788)
This pull request adds "Vary: Accept" header to responses from the image optimizer (i.e. the /_next/image endpoint).

The image optimizer prefers re-encoding JPG files to WebP, but some browsers (such as Safari 14 on Catalina) do not yet support WebP. In such cases the optimizer uses the Accept header sent by the browser to send out a JPG response. Thus the optimizer's response may depend on the Accept header.

Potential caching proxies can be informed of this fact by adding "Vary: Accept" to the response headers. Otherwise WebP data may be served to browsers that do not support it, for example in the following scenario:
 * A browser that supports WebP requests the JPG. The optimizer re-encodes it to WebP. The proxy caches the WebP data.
 * After this another browser that doesn't support WebP requests the JPG. The proxy sends the WebP data to the browser.

- [x] Integration tests added
- [x] Make sure the linting passes
2021-07-01 19:59:16 +00:00
.github Update repo scripts to separate folder (#26787) 2021-07-01 13:41:27 +02:00
.vscode Remove bugfix needed for webpack 4 when webpack 5 is used (#23886) 2021-04-11 15:06:35 +00:00
bench Replace 'require' with 'import' in bench files and update dependancies (#25775) 2021-06-04 14:30:52 +00:00
docs Add onLoadingComplete() prop to Image component (#26824) 2021-07-01 18:51:20 +00:00
errors chore: Enable Alex documentation linting for error pages (#26526) 2021-06-23 23:33:58 -05:00
examples examples: fix typo lunixlinux (#26796) 2021-07-01 06:20:35 +00:00
packages Add "Vary: Accept" header to /_next/image responses (#26788) 2021-07-01 19:59:16 +00:00
scripts Update repo scripts to separate folder (#26787) 2021-07-01 13:41:27 +02:00
test Add "Vary: Accept" header to /_next/image responses (#26788) 2021-07-01 19:59:16 +00:00
.alexignore Enable Alex documentation linting for docs (#26598) 2021-06-25 11:40:50 -05:00
.alexrc Enable Alex documentation linting for docs (#26598) 2021-06-25 11:40:50 -05:00
.eslintignore feat(create-next-app): add --ts, --typescript support (#24655) 2021-05-07 10:08:16 +02:00
.eslintrc.json Upgrade eslint to the latest version (#24377) 2021-04-25 18:34:36 +00:00
.gitignore Ignore emacs lockfiles (#20497) 2020-12-29 16:12:36 +00:00
.npmrc Remove version prefix 2018-10-02 01:35:56 +02:00
.prettierignore feat: webpack inlining with configuration for v4 / v5 (#20598) 2021-01-13 20:59:08 -05:00
.prettierignore_staged feat: webpack inlining with configuration for v4 / v5 (#20598) 2021-01-13 20:59:08 -05:00
.prettierrc.json Prettier trailingComma default value to es5 since 2.0 (#14391) 2020-06-22 13:25:24 +02:00
azure-pipelines.yml Update azure tests (#26779) 2021-06-30 17:03:43 -05:00
CODE_OF_CONDUCT.md Update Code of Conduct email address (#12108) 2020-04-22 16:27:24 +02:00
contributing.md chore: Add Alex to lint documentation (#26354) 2021-06-22 16:03:12 +00:00
data.sqlite Fix export worker threads options (#25063) 2021-05-14 12:50:29 +02:00
jest.config.js Upgrade jest-worker (#23077) 2021-03-16 21:08:35 +00:00
lerna.json v11.0.2-canary.3 2021-06-28 10:50:14 -05:00
license.md Update license year for all packages 2021-01-11 11:12:19 +01:00
lint-staged.config.js Replace CLIEngine with ESLint (#25801) 2021-06-09 13:54:10 +02:00
package.json Update repo scripts to separate folder (#26787) 2021-07-01 13:41:27 +02:00
readme.md Monorepo (#5341) 2018-10-01 01:02:10 +02:00
release.js Match last PR mention in commit message for release notes 2021-05-07 19:53:38 +02:00
run-tests.js Run acceptance tests non-concurrently (#25861) 2021-06-07 20:57:15 +02:00
SECURITY.md Create SECURITY.md 2020-07-13 19:25:08 +02:00
skip-docs-change.js Update repo scripts to separate folder (#26787) 2021-07-01 13:41:27 +02:00
test-file.txt Add additional file serving tests (#12479) 2020-05-04 11:58:19 -05:00
UPGRADING.md Move upgrading guide to /docs (#10727) 2020-02-28 23:46:18 +01:00
vercel.json Silence GH Comments for Preview URLs (#18766) 2020-11-03 21:59:47 +00:00
yarn.lock Support new hydrate API in latest react 18 alpha release (#26664) 2021-06-30 17:03:32 +02:00

Next.js

Getting Started

Visit https://nextjs.org/learn to get started with Next.js.

Documentation

Visit https://nextjs.org/docs to view the full documentation.

Who is using Next.js?

Next.js is used by the world's leading companies. Check out the Next.js Showcase to learn more.

Community

The Next.js community can be found on GitHub Discussions, where you can ask questions, voice ideas, and share your projects.

To chat with other community members you can join the Next.js Discord.

Our Code of Conduct applies to all Next.js community channels.

Contributing

Please see our contributing.md.

Good First Issues

We have a list of good first issues that contain bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process.

Authors