i have a registration end-point.
If someone discovered it, they could send garbage registrations into my database using cUrl.
Is it possible to prevent all cUrl requests that do not originate from www.mydomain.com so i dont need to worry about malicious account being created?
Note I'm using nginx on ubuntu and under /etc/nginx/sites-available/default
i set
location /
{
#save origin ip address
proxy_set_header X-Forwarded-For $remote_addr;
#...
}
and in my end-point I have
app.get('/api/register',function(req,res)
{
var ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
console.log(ip);
but the console always logs my host ip address, whether i send the request from my hosted website (using html and a form) or if i send a cURL request from my pc at home.
I also tried tinkering with
app.enable('trust proxy')