Sunday, 11 June 2017

NodeJS - Express get referer/ redirect origin

Is there a better way to get the origin of a redirect/link (referer) instead of using

if (request.headers.referrer !== undefined || request.headers.referer !== undefined) {}

This code won't work for some browsers that do not support 'referer'.

I want to only allow users access if they are redirected from a specific location (let's say anylink.com). I tried to give the link a special random generated number but once someone has the number this person can just access the site.

I am working with PHP too, so anything that's possible would be nice.

Example: user is 'anydomain.com' (not mine) that sends him to mydomain.com. mydomain.com disallows every 'direct' connections but allows the user to access this site because the user comes from 'anydomain.com'

as PHP session is limited to the domain. Any help would be nice! Thank you!



via Bostrot

No comments:

Post a Comment