how to get hostname?

30 views
Skip to first unread message

Dmitry Polyanovsky

unread,
Apr 16, 2015, 3:02:20 PM4/16/15
to chica...@googlegroups.com
Hi all,

let's say I need to provide absolute URLs in some cases and I want to support all hostnames I listen to
domain.com
www.domain.com
https://domain.com
and even domain.net

I can get protocol with Req:protocol() or Req:header("x-forwarded-proto") if there nginx behind.

But there is no Req:host() or something. Any ideas?

Tim McNamara

unread,
Apr 16, 2015, 3:04:52 PM4/16/15
to chica...@googlegroups.com

Req:header("host") might work. There may be the occasional HTTP request that excludes the Host header though.

--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/257babd2-500b-46a9-8d3b-9cbe176275d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dmitry Polyanovsky

unread,
Apr 16, 2015, 3:33:34 PM4/16/15
to chica...@googlegroups.com
tnx!
actually, after cup of coffee I got same idea. Sometimes obvious things are not so clear.
btw, cowboy has such function, but simple bridge doesn't




On Thursday, April 16, 2015 at 10:04:52 PM UTC+3, Tim McNamara wrote:

Req:header("host") might work. There may be the occasional HTTP request that excludes the Host header though.

On 17 Apr 2015 7:02 am, "Dmitry Polyanovsky" <dmitry.po...@gmail.com> wrote:
Hi all,

let's say I need to provide absolute URLs in some cases and I want to support all hostnames I listen to
domain.com
www.domain.com
https://domain.com
and even domain.net

I can get protocol with Req:protocol() or Req:header("x-forwarded-proto") if there nginx behind.

But there is no Req:host() or something. Any ideas?

--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss+unsubscribe@googlegroups.com.

Tim McNamara

unread,
Apr 16, 2015, 4:13:28 PM4/16/15
to chica...@googlegroups.com
Glad to hear that it helped.

On Fri, 17 Apr 2015 at 07:33 Dmitry Polyanovsky <dmitry.po...@gmail.com> wrote:
tnx!
actually, after cup of coffee I got same idea. Sometimes obvious things are not so clear.
btw, cowboy has such function, but simple bridge doesn't




On Thursday, April 16, 2015 at 10:04:52 PM UTC+3, Tim McNamara wrote:

Req:header("host") might work. There may be the occasional HTTP request that excludes the Host header though.

On 17 Apr 2015 7:02 am, "Dmitry Polyanovsky" <dmitry.po...@gmail.com> wrote:
Hi all,

let's say I need to provide absolute URLs in some cases and I want to support all hostnames I listen to
domain.com
www.domain.com
https://domain.com
and even domain.net

I can get protocol with Req:protocol() or Req:header("x-forwarded-proto") if there nginx behind.

But there is no Req:host() or something. Any ideas?

--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss...@googlegroups.com.

Jesse Gumm

unread,
Apr 16, 2015, 7:59:14 PM4/16/15
to chica...@googlegroups.com
Yeah, simple bridge doesn't provide a built-in host() function, mostly
because header(host) always felt sufficient.

I'm not entirely sure if I'm opposed to adding a host() function, if
only to keep the number of exported functions down to the bare
minimum. But maybe I can be convinced!

(BTW, sometime this summer, I should find the time to finally upgrade
CB to SimpleBridge 2.0).

:)
>>> email to chicagoboss...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups
> "ChicagoBoss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to chicagoboss...@googlegroups.com.
> Visit this group at http://groups.google.com/group/chicagoboss.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/chicagoboss/c075f2ef-e2a5-43d7-b931-831979c75e87%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm
Reply all
Reply to author
Forward
0 new messages