How do I find the a referring sites URL in node?

I'm using express, would I find this in the headers on connect or something?

Thanks!

2 Answers

In express 4.x:

req.get('Referrer') 

This will also check both spellings of referrer so you do not have to do:

 req.headers.referrer || req.headers.referer 

Here is the documentation

1

If you mean how do you get it when running an express server, then it's done using the header method on your request:

req.headers.referer; // => "" 
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy