drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nira Amit <amitn...@gmail.com>
Subject Cross Origin REST API calls in embedded mode (for testing)
Date Sun, 30 Aug 2015 19:51:09 GMT
Hello Drill developers,
I'm implementing a module that reads data from Drill and feeds it into a
visualization tool. I have a working embedded Drill installation with my
data on it and when I query it with curl it works just fine:

curl --header "Content-type: application/json" --request POST --data
@post.json http://localhost:8047/query.json

where post.json contatins:
{"queryType" : "SQL", "query" : "select * from
 vzb.dev.`/bigdata/parquet_basic_indicators` limit 1"}

returns:
{
  "columns" : [ "TIME", "GEO", "GDP_PER_CAP", "LEX", "POP", "GEO_NAME",
"GEO_CAT", "GEO_REGION" ],
  "rows" : [ {
    "GEO" : "world",
    "POP" : "5858793283",
    "GDP_PER_CAP" : "8780.9",
    "GEO_NAME" : "World",
    "GEO_CAT" : "planet",
    "TIME" : "1990",
    "GEO_REGION" : "\r",
    "LEX" : "65.76"
  } ]
}

however, if I try to invoke such a Post request from a script, I'm getting:
XMLHttpRequest cannot load http://localhost:8047/query.json. Origin file://
is not allowed by Access-Control-Allow-Origin.

So my question is: can I configure the embedded server to accept the
request? I can rebuild Drill in my local environment if necessary, I just
need to know what to change in the code/configuration for it to work.

Thanks!
Nira.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message