login issues

7 views
Skip to first unread message

Franklin Brauning

unread,
Nov 28, 2016, 4:08:41 PM11/28/16
to Nitrogen Project / The Nitrogen Web Framework for Erlang
I'm having a weird issue in a development machine and with firefox (not seamonkey [firefox based], not opera, nor chrome)

My site's login.erl checks authenticates and stores wf:user(User), right? [I double check with ?PRINT]
the next line redirects to perms:home()

And of course, perms:home() has to use wf:user() to know what is the home page of this user, BUT wf:user()
IS RETURNING undefined

I'm accessing the page with localhost:8000/   (this fails)
BUT WHEN I ACCESS 127.0.0.1:8000 ALL IS FINE.

/etc/hosts contains this lines:
127.0.0.1       localhost

This setup has worked me for a long time and this issue has just revealed today. I was using firefox 45 and just for checking
I downloaded firefox 50 (still failing)

Weird is that I'm getting seemingly random fails and correct attempts.
For example, just right now, typed (in a 4 seconds lapse)
 1 attempt: wf:user() returns undefined (get redirected to login again)
 2 attemp: undefined
 3 attemp: User (correct :(, why why why)
 ... still logged in, I click some of the available links in the "home page" (those also depend on wf:user())
 ... and again, random clicking will take me again to login (wf:user() randomly returning undefined)

I did  a repository verification, a make clean, a make again, rebooted machine :(
and just when accessing with Firefox through the "localhost" name I get this weird behaviour.

Btw, I also have another not-localhost name pointing to 127.0.0.1 and it works just fine.



Jesse Gumm

unread,
Nov 28, 2016, 4:23:52 PM11/28/16
to nitrogenweb
I've never run into this before, but a little googling revealed that "localhost" not being an actual valid domain name can lead to wonkiness with cookies (which apparently by their specification should require an actual domain name).

As I understand it, the cookies don't specify the domain name, so it shouldn't matter, but my guess is that that's all you're facing.

From my reading, the presence of dots is what validates it for the relevant browsers.

I'd have to experiment further with the different backends (cowboy vs yaws), and see what happens.

But this looks to be a manifestation of that.

I'd tweak the hosts file to add something like

127.0.0.1 mytest.com

and access it from mytest:8000 and see what happens.

-Jesse



--
You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nitrogenweb+unsubscribe@googlegroups.com.
To post to this group, send email to nitro...@googlegroups.com.
Visit this group at https://groups.google.com/group/nitrogenweb.
For more options, visit https://groups.google.com/d/optout.



--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

Franklin Brauning

unread,
Nov 28, 2016, 7:10:35 PM11/28/16
to Nitrogen Project / The Nitrogen Web Framework for Erlang
127.0.0.1       myhost (no domain)
works just fine.

This was on office machine, now in home with laptop with same distro
(the very same hosts line) localhost:8000 works ok.

So this is a particular thing
in that laptop. And at this point it just seems a browser thing, not nitrogen's.
I expect to track this thing down tomorrow just to be clear from all doubts, thanks.
Reply all
Reply to author
Forward
0 new messages