thanks, heiko.  my site relies heavily on proper handling many host 
subdomains.    for example, my auth subdomain handles OAuth intereactions 
with google, which are subdomain specific.  and then each of my users has 
their own vanity subdomain, but they nicely share session information. 
 once logged into one subdomain, they can go to another.  so, for my case, 
the usual testing just within sites (get_ok('/')) is insufficient.  I 
really do need to work with full http:// and URLs to obtain the subdomain 
and make different decisions based on it.  I guess my app is unusual :-(.

localhost as a testname for websites was IMHO never a great choice as the 
solo definition.  localhost.test would have been a better (or additional) 
choice.  localhost.test should keep the testing to remain on 127.0.0.1, and 
just work the same way any other domain name works---subdomains and 
everything.  grrr.  alas, we live with what we have.

indeed, browsers treat subdomains on localhost differently.  chrome handles 
subdomains on localhost, but the M useragent and firefox and safari do not.

so here is one solution, although this one does not work in chrome:  Add 
'localhost.test' and 'auth.localhost.test' at the end of 127.0.0.1 
localhost in /etc/hosts and `# morbo -v appname -l 
http//localhost.test:3000`.  now, http://localhost.test:3000/ works just 
fine with safari, firefox, and the Mojolicious test agent (but not chrome).

in the end, this was not a Mojolicious bug, but a web bug.

thanks for the help, heiko.

regards,

/iaw


On Sunday, May 28, 2017 at 11:12:14 AM UTC-7, Heiko Jansen wrote:
>
> Am Sonntag, 28. Mai 2017 19:34:11 UTC+2 schrieb iaw4:
>>
>>
>> my app redirects to http://auth.localhost:3000/index ,
>>
>
> Well, on my OpenSUSE box neither the "host" nor the "nslookup" (or "dig") 
> commands return an IP address for "auth.localhost" (they do, of course, for 
> "localhost"), so I´d say that explains the "Can't connect: nodename nor 
> servname provided, or not known" error message in your initial post.
>
> The new demo code shows a different error:
>
> and the output is
>> # Connection refused
>>
>  
>  AFAIK, you should _not_ provide a hostname and port as parameter to 
> get_ok().
> So I'd say a corrected test file should look like this:
>
> use Test::More; 
> use Test::Mojo; 
>  
> use FindBin; 
> require "$FindBin::Bin/../myapp.pl"; 
>  
> my $t = Test::Mojo->new; 
>  
> $t->ua->max_redirects(100); 
> $t->get_ok('/')->status_is(200); # ->content_like( qr{abc}); 
>  
> done_testing();
>
> If I test this with your server code (running "perl myapp.pl test -v t/
> t.pl") I once again get the "Can't connect: nodename nor servname 
> provided, or not known" error message.
>
> My browser follows without problems.  I am guessing the Mojo Test daemon 
>> does not...
>>
>
> I´d say that the Chrome browser you use shows some non-standard behavior 
> here since I believe that localhost isn't a proper domain that could take 
> subdomains. 
> But I cannot provide an authoritative source for that right now.
> Try using a different browser like Firefox for a start.
>
> - Heiko
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to