0
I need to know which external url the user accessed on my server. My script works well when the route is "localhost", but it doesn’t work to know what the url is when the domain is not the same as this one. I need that when typed "https://www.google.com" my server print on the console that the url was this.
const url = require("url");
const app = require("express")()
var privateKey = fs.readFileSync('keys/key.key', 'utf8');
var certificate = fs.readFileSync('keys/key.cert', 'utf8');
app.use((req, res) => {
console.log(req) //AQUI ELE SÓ MOSTRA AS ROTAS QUE COMEÇAM COM LOCALHOST
})
var serverssl = https.createServer({key: privateKey, cert: certificate}, app).listen(443);
A requisition
http
does not include data from which page the user was on before accessing your page. The only way to get some information about user activity is by tracking user cookies through services such as Google Analytics for example. If you want to know where the user is going after leaving your site, it is also not possible as the request is not sent to your server.– Andre
I don’t want the page he was on before, I want the page he was on at the exact moment... But I think Node is unable to give me the data of a https URL
– Jos Eduardo Sampaio de Aguiar