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
In Express 5, the `express.static` middleware's `dotfiles` option now defaults to `"ignore"`. This is a change from Express 4, where dotfiles were served by default. As a result, files inside a directory that starts with a dot (`.`), such as `.well-known`, will no longer be accessible and will return a **404 Not Found** error. This can break functionality that depends on serving dot-directories, such as Android App Links, and Apple Universal Links.
470
+
471
+
Example of breaking code:
472
+
473
+
```js
474
+
// v4
475
+
app.use(express.static('public'))
476
+
```
477
+
478
+
After migrating to Express 5, a request to `/.well-known/assetlinks.json` will result in a **404 Not Found**.
479
+
480
+
To fix this, serve specific dot-directories explicitly using the `dotfiles: "allow"` option:
This approach allows you to safely serve only the intended dot-directories while keeping the default secure behavior for other dotfiles, which remain inaccessible.
489
+
490
+
465
491
<h3id="app.listen">app.listen</h3>
466
492
467
493
In Express 5, the `app.listen` method will invoke the user-provided callback function (if provided) when the server receives an error event. In Express 4, such errors would be thrown. This change shifts error-handling responsibility to the callback function in Express 5. If there is an error, it will be passed to the callback as an argument.
0 commit comments