I have my Server on Google App Engine
and I am using npm module yes-https, below is the code I am writing in order to restrict the requests to Https.
app.use(yes({
maxAge: 86400, // defaults `86400`
includeSubdomains: true, // defaults `true`
preload: true // defaults `true`
}));
Previously this code was working fine and all my requests whether Https
OR Http
all were getting routed to Https
. But now I don't know why requests coming to Http is not getting routed to Https.
Can anyone please tell me why is this happening.
Hello actually this plugin is working perfectly fine. The mistake I was doing was I was putting
yes-https
on themiddleware
after the setting the/public
directory, but the right way was to put it before setting/public
directory.Right Code
Wrong Code
Because of which
Https
was not enforcing but now everything is working as expected.