Even if Magento is in Dev mode, Nginx may set caching headers on Javascript and CSS files:
$ bin/magento deploy:mode:show
Current application mode: developer. (Note: Environment variables may override this value.)
See that Note
? And sure enough:
$ curl -v 'https://foo.local/static/version51/adminhtml/Magento/backend/en_US/Dc_Foo/js/foo.js'
< HTTP/1.1 200 OK
< Server: nginx/1.21.6
< Date: Tue, 12 Jul 2022 12:00:07 GMT
< Content-Type: application/javascript; charset=utf-8
< Content-Length: 1082
< Last-Modified: Tue, 12 Jul 2022 05:57:18 GMT
< Connection: keep-alive
< ETag: "62cd0d3e-43a"
< Expires: Wed, 12 Jul 2023 12:00:07 GMT
< Cache-Control: max-age=31536000
< Cache-Control: public
< X-Frame-Options: SAMEORIGIN
< Accept-Ranges: bytes
Note the Expires
header, set for one year in the future (answer written July 2022).
You can configure Nginx or Apache or any other server to not serve these headers, but my preferred method is to configure my browser to ignore caching when development tools are in use. In Chrome that can be accomplished by opening DevTools (F12
), then clicking on the gear icon (⚙
), then checking Preferences -> Network -> Disable cache while DevTools is open
.