toadfarm - how to tell which domain is calling app ?

29 views
Skip to first unread message

mjb152

unread,
May 13, 2015, 6:34:56 AM5/13/15
to mojol...@googlegroups.com
I'm using toadfarm to handle 3 domains, and each of these has several subdomains pointing at it.
How can I detect which domain is calling my app ?

mount "/apps/xx/script/myapp" => { "X-Request-Base" => "http://d1.domain.co.uk" };
mount "/apps/xx/script/myapp" => { "X-Request-Base" => "http://d2.domain.co.uk" };
mount "/apps/xx/script/myapp" => { "X-Request-Base" => "http://d3.domain.co.uk" };

mjb152

unread,
May 13, 2015, 7:55:45 AM5/13/15
to mojol...@googlegroups.com
apologies for self answering, but it might be of use to somebody else.

my $base = $self->req->headers->header('X-Request-Base');

Jan Henning Thorsen

unread,
May 13, 2015, 9:57:23 AM5/13/15
to mojol...@googlegroups.com, martin...@gmail.com
You should also be able to use:

  $domain = $c->req->url->to_abs->host;
Reply all
Reply to author
Forward
0 new messages