You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-55
Original file line number
Diff line number
Diff line change
@@ -14,50 +14,7 @@ commands separately will not work, because the Next.js Runtime will not generate
14
14
## Using `next/image`
15
15
16
16
If you use [`next/image`](https://nextjs.org/docs/basic-features/image-optimization), your images will be automatically
17
-
optimized at runtime, ensuring that they are served at the best size and format. The image will be processed on the
18
-
first request which means it may take longer to load, but the generated image is then cached and served as a static file
19
-
to future visitors. By default, Next.js will deliver WebP images if the browser supports it. WebP is a modern image format
20
-
with wide browser support that will usually generate smaller files than PNG or JPG. Additionally, you can enable AVIF
21
-
format, which is often even smaller in filesize than WebP. The drawback is that with particularly large images, AVIF images may
22
-
take too long to generate, and the function times-out. You can configure
23
-
[the supported image formats](https://nextjs.org/docs/api-reference/next/image#acceptable-formats) in your
24
-
`next.config.js` file.
25
-
26
-
### Enabling Edge Images
27
-
28
-
It is possible to run image content negotiation on the edge. This allows images to be processed on the first request,
29
-
and then, in future loads, served from cache on the edge.
30
-
31
-
In order to deliver the correct format to a visitor's browser, this uses a Netlify Edge Function. In some cases your
32
-
site may not support Edge Functions, in which case it will instead fall back to delivering the original file format.
33
-
34
-
To turn on Edge image handling for Next/Image, set the environment variable `NEXT_FORCE_EDGE_IMAGES` to `true`
35
-
36
-
## Returning custom response headers on images handled by `ipx`
37
-
38
-
Should you wish to return custom response headers on images handled by the
39
-
[`netlify-ipx`](https://github.com/netlify/netlify-ipx) package, you can add them within your project's `netlify.toml`
40
-
by targeting the `/_next/image/*` route:
41
-
42
-
```
43
-
[[headers]]
44
-
for = "/_next/image/*"
45
-
46
-
[headers.values]
47
-
Strict-Transport-Security = "max-age=31536000"
48
-
X-Test = 'foobar'
49
-
```
50
-
51
-
## Disabling included image loader
52
-
53
-
If you wish to disable the use of the image loader which is bundled into the runtime by default, set the `DISABLE_IPX`
54
-
environment variable to `true`.
55
-
56
-
This should only be done if the site is not using `next/image` or is using a different loader (such as Cloudinary or
57
-
Imgix).
58
-
59
-
See the [Next.js documentation](https://nextjs.org/docs/api-reference/next/image#built-in-loaders) for image loader
60
-
options.
17
+
optimized at runtime using the Netlify Image CDN.
61
18
62
19
## Next.js Middleware on Netlify
63
20
@@ -91,7 +48,10 @@ Note that Netlify has a minimum TTL of 60 seconds for revalidation.
91
48
92
49
## Disable Static 404 on Dynamic Routes with fallback:false
93
50
94
-
Currently when hitting a non-prerendered path with `fallback=false` it will default to a 404 page. You can now change this default setting by using the environemnt variable `LEGACY_FALLBACK_FALSE=true`. With the environment variable set, those non-prerendered paths will now be routed through using the ISR Handler and will allow you to add redirects for those non-prerendered paths.
51
+
Currently when hitting a non-prerendered path with `fallback=false` it will default to a 404 page. You can now change
52
+
this default setting by using the environemnt variable `LEGACY_FALLBACK_FALSE=true`. With the environment variable set,
53
+
those non-prerendered paths will now be routed through using the ISR Handler and will allow you to add redirects for
54
+
those non-prerendered paths.
95
55
96
56
## Use with `next export`
97
57
@@ -111,14 +71,12 @@ that it is not enabled at **Site settings > Build & deploy > Post processing > A
111
71
## Generated functions
112
72
113
73
The Next.js Runtime works by generating three Netlify functions that handle requests that haven't been pre-rendered.
114
-
These are `___netlify-handler` (for SSR and API routes), `___netlify-odb-handler` (for ISR and fallback routes), and
115
-
`_ipx` (for images). You can see the requests for these in
116
-
[the function logs](https://docs.netlify.com/functions/logs/). For ISR and fallback routes you will not see any requests
117
-
that are served from the edge cache, just actual rendering requests. These are all internal functions, so you won't find
118
-
them in your site's own functions directory.
74
+
These are `___netlify-handler` (for SSR and API routes) and `___netlify-odb-handler` (for ISR and fallback routes). You
75
+
can see the requests for these in [the function logs](https://docs.netlify.com/functions/logs/). For ISR and fallback
76
+
routes you will not see any requests that are served from the edge cache, just actual rendering requests. These are all
77
+
internal functions, so you won't find them in your site's own functions directory.
119
78
120
-
The Next.js Runtime will also generate a Netlify Edge Function called 'ipx' to handle image content negotiation, and if
121
-
Edge runtime or middleware is enabled it will also generate edge functions for middleware and edge routes.
79
+
If Edge runtime or middleware is enabled it will also generate edge functions for middleware and edge routes.
122
80
123
81
## Manually installing the Next.js Runtime
124
82
@@ -190,13 +148,15 @@ npm test
190
148
191
149
### End-to-end tests
192
150
193
-
In order to run the end-to-end (E2E) tests, you'll need to be logged in to Netlify. You can do this using the [Netlify CLI](https://github.com/netlify/cli) with the command:
151
+
In order to run the end-to-end (E2E) tests, you'll need to be logged in to Netlify. You can do this using the
152
+
[Netlify CLI](https://github.com/netlify/cli) with the command:
194
153
195
154
```shell
196
155
netlify login
197
156
```
198
157
199
-
Alternatively, you can set an environment variable `NETLIFY_AUTH_TOKEN` to a valid Netlify personal access token. This can be obtained from the [Netlify UI](https://docs.netlify.com/cli/get-started/#obtain-a-token-in-the-netlify-ui).
158
+
Alternatively, you can set an environment variable `NETLIFY_AUTH_TOKEN` to a valid Netlify personal access token. This
159
+
can be obtained from the [Netlify UI](https://docs.netlify.com/cli/get-started/#obtain-a-token-in-the-netlify-ui).
200
160
201
161
Then run the E2E tests if logged in:
202
162
@@ -210,7 +170,8 @@ Or if using an access token:
210
170
NETLIFY_AUTH_TOKEN=your-token-here npm run test:next
211
171
```
212
172
213
-
_Note: The E2E tests will be deployed to a Netlify owned site. To deploy to your own site then set the environment variable `NETLIFY_SITE_ID` to your site ID._
173
+
_Note: The E2E tests will be deployed to a Netlify owned site. To deploy to your own site then set the environment
0 commit comments