A way to get HTTP_REFERER
, We can use document.referrer
in browser side javascript . But how can we get it in NodeJS ?
1 Answer. Show activity on this post. var http = require('http'); server = http. createServer(function(req, res){ ... }
You have to store in session. app. get('/url1', function(req, res){ res. send('ok') req.
To check the Referer in action go to Inspect Element -> Network check the request header for Referer like below. Referer header is highlighted. Supported Browsers: The browsers are compatible with HTTP header Referer are listed below: Google Chrome.
$_SERVER['HTTP_HOST'] Returns the Host header from the current request. $_SERVER['HTTP_REFERER'] Returns the complete URL of the current page (not reliable because not all user-agents support it)
You can get it by...
req.headers.referer
in...
var http = require('http'); server = http.createServer(function(req, res){ ... }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With