map

14 views
Skip to first unread message

Joshua Warchol

unread,
Mar 25, 2011, 12:38:56 PM3/25/11
to Goliath.io
Is the map syntax for setting up routes, as shown in the examples,
functional? I've tried to run the examples/custom_server.rb and
examples/rack_routes.rb servers and only get back 404's.

Matt Aimonetti

unread,
Mar 25, 2011, 12:40:52 PM3/25/11
to golia...@googlegroups.com, Joshua Warchol
I was when I worked on it :p It's just rack routes, nothing more fancy. A recent change might have broken it tho.

- Matt

dan sinclair

unread,
Mar 25, 2011, 1:17:40 PM3/25/11
to golia...@googlegroups.com, Joshua Warchol
When you try to query the API are you using 127.0.0.1 or localhost? Goliath is setup to have an internal server name of localhost and the Rack URLMap attempts to match the incoming URL with the internal name. (Unless you specified a host in the map itself).

If you use 127.0.0.1 it will come back as 404 I believe.

Otherwise, can you send the curl command you're using to access the API and I can take a look.

Thanks,
dan

Mando Escamilla

unread,
Mar 25, 2011, 1:23:45 PM3/25/11
to golia...@googlegroups.com, dan sinclair, Joshua Warchol
This JUST bit me :).  ab on my local machine (I know, not a real test) really doesn't like using localhost.

In other news, map works fine for me.

--
Mando

Joshua Warchol

unread,
Mar 25, 2011, 1:39:54 PM3/25/11
to Goliath.io

On Mar 25, 1:17 pm, dan sinclair <d...@everburning.com> wrote:
> When you try to query the API are you using 127.0.0.1 or localhost? Goliath is setup to have an internal server name of localhost and the Rack URLMap attempts to match the incoming URL with the internal name. (Unless you specified a host in the map itself).
>
> If you use 127.0.0.1 it will come back as 404 I believe.
>
> Otherwise, can you send the curl command you're using to access the API and I can take a look.

Ahh, I didn't know the hostname was important for map. I was using a
fully qualified URL to an ec2 instance. How do you specify what server
name it should consider? I don't see it in the server options wiki
documentation.

Ilya Grigorik

unread,
Mar 25, 2011, 1:43:02 PM3/25/11
to golia...@googlegroups.com, Joshua Warchol
You can specify the address on which Goliath should listen on via -a. Having said that, we have an outstanding bug to resolve around this:

It's a simple fix, just need to carve out some time to get to it!

ig

Joshua Warchol

unread,
Mar 25, 2011, 1:49:26 PM3/25/11
to Goliath.io
On Mar 25, 1:43 pm, Ilya Grigorik <i...@postrank.com> wrote:
> You can specify the address on which Goliath should listen on via -a. Having
> said that, we have an outstanding bug to resolve around this:https://github.com/postrank-labs/goliath/issues#issue/13
>
> It's a simple fix, just need to carve out some time to get to it!

Thank you both for the responses! I knew I must have been missing
something.

Mando Escamilla

unread,
Mar 25, 2011, 1:55:50 PM3/25/11
to golia...@googlegroups.com
Ilya,

I was just digging around in this code earlier.  I can send a pull request, but I'm not exactly sure what we want done.  Should we take the address value and set SERVER_NAME to it?

--
Mando

Joshua Warchol

unread,
Mar 25, 2011, 2:12:14 PM3/25/11
to golia...@googlegroups.com, Mando Escamilla
On Fri, Mar 25, 2011 at 1:55 PM, Mando Escamilla
<mando.e...@gmail.com> wrote:
> Ilya,
> I was just digging around in this code earlier.  I can send a pull request,
> but I'm not exactly sure what we want done.  Should we take the address
> value and set SERVER_NAME to it?

It's very useful to be able to tell the process to bind to one thing,
but expect requests with a hostname of something else entirely. In my
ec2 example, I want to bind to 0.0.0.0, but I'll be hitting it with at
least one hostname from the clients, preferring to be able to hit it
from many, or any, hostname.

That's my take on it. I'm new to Goliath, coming from years of Rails
work, and got a bit tripped up by even having to think about the
hostname in such a simple example.

dan sinclair

unread,
Mar 25, 2011, 2:12:33 PM3/25/11
to golia...@googlegroups.com
I was thinking about this and I don't think the value of -a is what we want. The -a takes the IP address to bind the server too. In this case, we need the hostname that we want the server to think it is.

So, I don't want 127.0.0.1 I want dan.localhost.

Not sure if this should be another option to the server? Or a lookup on startup for the domain name that matches the -a address?

Thoughts?
dan

Mando Escamilla

unread,
Mar 25, 2011, 2:20:47 PM3/25/11
to golia...@googlegroups.com
Honestly, I would expect that if I bind to 0.0.0.0 that Goliath would respond properly to 127.0.0.1, localhost, mando.localhost. etc.

--
Mando

dan sinclair

unread,
Mar 25, 2011, 2:30:09 PM3/25/11
to golia...@googlegroups.com
Goliath responds fine. It's the Rack URLMap code that wants the names to match. If you're not using map then Goliath doesn't do anything to match the hostname on input and the request is processed.

There maybe something I'm missing with URLMap or the way I setup the map stuff in Goliath that is causing this to not work but I didn't see anything.

dan

Mando Escamilla

unread,
Mar 25, 2011, 2:46:07 PM3/25/11
to golia...@googlegroups.com
Of course - I should have been clearer :).

The cheat might be that if maps isn't empty, make sure that SERVER_NAME:SERVER_PORT and HTTP_HOST are the same ;).

--
Mando

igrigorik

unread,
Mar 26, 2011, 7:23:31 PM3/26/11
to golia...@googlegroups.com, Mando Escamilla
Reply all
Reply to author
Forward
0 new messages