rohanray / next-fonts

Import fonts in Next.js (supports woff, woff2, eot, ttf, otf & svg)
179 stars 12 forks source link

set output path to chunks folder inside static #15

Closed oddnavy closed 5 years ago

oddnavy commented 5 years ago

This avoids an issue where cache-control maxage being set to 0.

Fonts are currently served by Next with the following headers:

HTTP/1.1 200 OK
X-Powered-By: Express
Accept-Ranges: bytes
Cache-Control: public, max-age=0
Last-Modified: Tue, 30 Jul 2019 05:41:03 GMT
ETag: W/"7ee0-16c4165726c"
Content-Type: application/font-woff2
Content-Length: 32480
Date: Tue, 30 Jul 2019 05:43:32 GMT
Connection: keep-alive

This PR updates the output path to be static/chunks/fonts which ensures Next adds the default static asset cache header to the response.

HTTP/1.1 200 OK
X-Powered-By: Express
Cache-Control: public, max-age=31536000, immutable
Accept-Ranges: bytes
Last-Modified: Tue, 30 Jul 2019 05:37:37 GMT
ETag: W/"4ae4-16c4162501a"
Content-Type: application/font-woff2
Content-Length: 19172
Date: Tue, 30 Jul 2019 05:40:20 GMT

Further reading

rohanray commented 5 years ago

Thanks much @oddnavy for the PR! Regards -RR