Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RabbitMQ HTTP API call to aliveness-test returns 404 but other calls work

When using the HTTP API I am trying to make a call to the aliveness-test for monitoring purposes. At the moment I am testing using curl and the following command:

 curl -i http://guest:guest@localhost:55672/api/aliveness-test/

And I get the following response:

HTTP/1.1 404 Object Not Found
Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
Date: Mon, 05 Nov 2012 17:18:58 GMT
Content-Type: text/html
Content-Length: 193

<HTML><HEAD><TITLE>404 Not Found</TITLE></HEAD><BODY><H1>Not Found</H1>The requested document was not found on this server.<P><HR><ADDRESS>mochiweb+webmachine web server</ADDRESS></BODY></HTML>

When making a request just to list the users or vhosts, the requests returns successfully:

$ curl -I http://guest:guest@localhost:55672/api/users

HTTP/1.1 200 OK
Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
Date: Mon, 05 Nov 2012 17:51:44 GMT
Content-Type: application/json
Content-Length: 11210
Cache-Control: no-cache

I'm using the latest stable version (2.8.7) of RabbitMQ and obviously have the management plugin installed for the API to work with the users call (the response is left out due to it containing company data but is just regular JSON as expected).

There isn't much on the internet about this call failing so I am wondering if anyone has seen this before?

Thanks, Kristian

like image 299
brimble2010 Avatar asked Nov 05 '12 17:11

brimble2010


1 Answers

Turns out that the '/' at the beginning of the vhosts names is not implicit, even when as part of a URL. To get this to work I simply changed my request from:

curl -i http://guest:guest@localhost:55672/api/aliveness-test/

To

curl -i http://guest:guest@localhost:55672/api/aliveness-test/%2F

As %2F is '/' HTTP encoded, my request now queries the vhost named '/' and returns a 200 response which looks like:

{"status":"ok"}
like image 51
brimble2010 Avatar answered Sep 22 '22 01:09

brimble2010