Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make .well-known directory visible in Express 4

This took me a while to figure out, so I figure I'd leave some instructions on how I got it done in case someone else runs into the same problems.

I needed to allow directory access to the .well-known directory in Express to be able to use certbot to generate SSL certificates.

like image 400
brycejl Avatar asked Sep 15 '25 21:09

brycejl


1 Answers

Install the serve-index package from npm

npm install serve-index

Import it

var serveIndex = require('serve-index');

Then declare the middleware

app.use('/.well-known', express.static('.well-known'), serveIndex('.well-known'));
like image 123
brycejl Avatar answered Sep 17 '25 09:09

brycejl