redirect-ssl icon indicating copy to clipboard operation
redirect-ssl copied to clipboard

exclude does not match hostname per readme

Open curtgrimes opened this issue 3 years ago • 1 comments

The readme currently has this example for using the exclude option:

app.use(redirectSSL.create({
   exclude: ['localhost']
}))

However, redirect-ssl uses req.url which will not include the hostname like "localhost". If I make a request to http://localhost/foobar, req.url will be /foobar and I won't be able to use the exclude option in the way the readme uses it to exclude a request like this one.

curtgrimes avatar May 31 '21 02:05 curtgrimes

I'm having the same issue

looks like you would have to include the req.headers.host to get the full URL, including 'localhost'

the line that curtgrimes linked (L30) would then become const url = req.headers.host + req.url || ''

samm81 avatar Jun 14 '21 18:06 samm81