I’m trying to make my domain always go to https, but even using cloudflare, it doesn’t redirect, it always sends me to a large url
Does anyone know how to fix it?
I’m trying to make my domain always go to https, but even using cloudflare, it doesn’t redirect, it always sends me to a large url
Does anyone know how to fix it?
Hey @DoginUwU,
Pasting this code in your server.js
can also force HTTPS for your website:
function checkHttps(req, res, next){
// protocol check, if http, redirect to https
if(req.get('X-Forwarded-Proto').indexOf("https")!=-1){
return next()
} else {
res.redirect('https://' + req.hostname + req.url);
}
}
app.all('*', checkHttps);
Hope this helps!
He keeps redirecting me to the large URL :c
and always req.get('X-Forwarded-Proto')
returns https
I would recommend using Cloudfare. You will have to change your current name servers to Cloudfare ones and once you have done that you can force encryption.
I was already using cloudflare, even with the option to force HTTPS active ;-;
Interesting. You did the setup correctly?
Yes, I’ve been messing with cloudflare for a long time, but this https never happened before
Hmm. Sorry I don’t know what to say!
It looks like everything is correct.
I actually just visited your website I could not view it without HTTPS.
Try using http://anigiri.ga?lang=pt-br
Yep, still gives me HTTPS.
HTTPS but at a large URL?
What?? Here he sends me to this URL
Thats odd.
Try view the project details of that page.
https://glitch.com/~(project url name here)
I didn’t find anything about this url. I have no more ideas than can be
The long is not a shw.io URL either, it’s just a Glitch project with a very long name…