I am logging to an express sesssion in two ways
http://myhostname.com/loginhttp://123.123.43.12/loginIp adress of myhostname.com is 123.123.43.12.
To check if someone is already logging, I basically do for this example
if (user === req.session.username && pwd === req.session.password)
Then I make the same AJAX inquiry from a page
http://myhostname.com/main.html , AJAX inquiry to http://123.123.43.12/ajax => Error not logginghttp://123.123.43.12/main.html, AJAX inquiry to http://123.123.43.12/ajax => SuccessHow can I tell expressJS (session) or node that myhostname.com and 123.123.43.12 are identical ?
You should check same origin policy. The rules for deciding if two urls are of same origin are strictly same protocol, host and port. myhostname.com and 123.123.43.12 are not of same origin by that.
AJAX follows same origin policy so it cannot inquiry any other page than its origin. Which is why if you access main from 123.123.43.12, you can access its ajax, but not from myhostname.com. If you use myhostname.com stick to it, or if you use 123.123.43.12 then stick to that. Don't use both interchangeably.