[rabbitmq-discuss] accessing rabbitmq with json-rpc

238 views
Skip to first unread message

huffl...@hush.com

unread,
Jun 18, 2011, 11:11:04 AM6/18/11
to rabbitmq...@lists.rabbitmq.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm trying to access my rabbitmq server using the json-rpc plugin
on my local machine using a js client (specifically, jquery).

Specifically, if I followed the examples correctly, I'm trying to
POST my requests to http://localhost:55670/rpc/rabbitmq

The problem I have is firefox blocking my request or rather turning
it into a preflight OPTIONS request, for which the corresponding
server should reply with some message allowing CORS (which rabbitmq
obviously doesn't do).

The examples in the plugin rabbitmq_jsonrpc_channel_examples don't
have this problem, since they sit on the same port, and are not
subject to CORS.

I got this problem only when I changed the contentType in my ajax
request to application/json. Apparently, this contentType requires
CORS, whereas the default application/x-www-form-urlencoded is
considered safe. Sending the data as application/x-www-form-
urlencoded doesn't get you any reply from rabbitmq.

I have no problem POSTing to rabbitmq with curl, so this is
obviously due to the limitation of the browser.

What am I doing wrong? Is it even possible to send a POST request
to rabbitmq without changing the example plugin and loading it
straight into rabbitmq? Otherwise (sorry if this sounds rude) what
is the point of json-rpc?

Maybe this is a really trivial question, but I've been looking for
an answer for the better part of the day.

Some references from what I've dug up:
https://groups.google.com/group/rabbitmq-
discuss/browse_thread/thread/5d3ad18f7c48b020?fwc=1

Thanks in advance
Jason
-----BEGIN PGP SIGNATURE-----
Charset: UTF8
Version: Hush 3.0
Note: This signature can be verified at https://www.hushtools.com/verify

wsBcBAEBAgAGBQJN/MAIAAoJEL7Kanawu8RE5YoH/RkA1YbYeer2ozfwEzF28Eb+wh4F
MpeLBlUtF+C2PFR8xo4yrt28pmGSFpvCTjwG/h35HuO3AxifM8x8eJSlmtBaQ+ffwfRu
s2Qupje5RhhG6iOFF9Akr4ZnhTfpIwqfYSKdN9HNtF+vp4uG/VY+KUiic/f1MQnBICOn
rfA4E5v6yvadsHXJI3Q7NEQHgIYcF4R4mTfzgR5dqtg9OEMEZWSqqy3wgADjx6GtykWs
0+uHafWiJzpafJaTQtqP7SrBL0XHmTyutS+402GNKXwpG+JFX94DDawdsfuhIl+hS3pj
tM/uX595tA6BEF5pBkRUe9F0IdIYhOPdtnQ9er4jOxs=
=8wUa
-----END PGP SIGNATURE-----

_______________________________________________
rabbitmq-discuss mailing list
rabbitmq...@lists.rabbitmq.com
https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Simon MacMullen

unread,
Jun 20, 2011, 9:49:17 AM6/20/11
to rabbitmq...@lists.rabbitmq.com
On 18/06/11 16:11, huffl...@hush.com wrote:
> What am I doing wrong? Is it even possible to send a POST request
> to rabbitmq without changing the example plugin and loading it
> straight into rabbitmq? Otherwise (sorry if this sounds rude) what
> is the point of json-rpc?

I assume that most people using json-rpc either:

1) Play with it in a trivial manner (i.e. serve static content with
RabbitMQ)

or

2) Use some HTTP proxying to make it seem like part of the same domain

or

3) Use it with some server-side http messaging (I think someone wrote a
PHP library which talks to JSON-RPC rather than AMQP?)

Having said that, it seems like CORS support would be a sensible thing
to add. Having said *that*, rabbitmq-jsonrpc-channel doesn't really have
a maintainer now, so I can't promise anything.

Cheers, Simon

--
Simon MacMullen
RabbitMQ, VMware

Reply all
Reply to author
Forward
0 new messages