0

I have a node server which I connect to from my website.

For certain requests it needs to know the webpage the request came from.

When I use req.headers.origin I get www.example.com instead of www.example.com/home/details

Stuff like req.path req.originalUrl req.host I just get the API route for example www.api.com/request or /request

StephenC
  • 61
  • 7

1 Answers1

0

I think the following code will do the the trick:

var fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl;

for more details please check complete answer in here

rouzbehsbz
  • 101
  • 6