cloudera / hue

Open source SQL Query Assistant service for Databases/Warehouses
https://cloudera.com
Apache License 2.0
1.14k stars 364 forks source link

"POST /calculator/ HTTP/1.1" 403 #238

Closed yoer closed 8 years ago

yoer commented 8 years ago

i have install the calculator app , but when i try the calculator, click the calculate button, and got this log:

i can't figure out how to fix this problem help me please, thanks a lot :)

yoer commented 8 years ago

i find the solution about 403 error, the moko had lost csrf token, it would be ok after append csrf_token in moko file.

...
<div class="container-fluid">
  % if op:
  <span>${a} ${op} ${b} = ${result}</span>
  % endif
  <form action=${url("calculator.views.index")} method=POST>
    <input name="a">
    <input type="radio" name="op" value="add">+</input>
    <input type="radio" name="op" value="subtract">-</input>
    <input type="radio" name="op" value="multiply">*</input>
    <input type="radio" name="op" value="divide">/</input>
    <input name="b">
    <input type="submit" value="Calculate">
  </form>
</div>
...

after

<div class="container-fluid">
  % if op:
  <span>${a} ${op} ${b} = ${result}</span>
  % endif
  <form action=${url("calculator.views.index")} method=POST>
    ${ csrf_token(request) | n,unicode }
    <input name="a">
    <input type="radio" name="op" value="add">+</input>
    <input type="radio" name="op" value="subtract">-</input>
    <input type="radio" name="op" value="multiply">*</input>
    <input type="radio" name="op" value="divide">/</input>
    <input name="b">
    <input type="submit" value="Calculate">
  </form>
</div>
./build/env/bin/python ./tools/app_reg/app_reg.py --sync
yoer commented 8 years ago

but still have this error

127.0.0.1 - - [29/Sep/2015 00:38:26] "GET /jobbrowser/?format=json&state=running&user=yoer HTTP/1.1" 500 
enricoberti commented 8 years ago

Awesome to hear you figured out the CSRF token bit :) The HTTP 500 is because you probably didn't configure Hue to talk to your Hadoop installation? What does it say on the "Check configuration" tab on the /about/ page?

romainr commented 8 years ago

Nice! And about the 'csrf_token' token, do you want us to fix it or could you just do a pull request?

yoer commented 8 years ago

@enricoberti thanks.

"Check configuration" show :

Potential misconfiguration detected. Fix and restart Hue.

hadoop.hdfs_clusters.default.webhdfs_url    Current value: http://localhost:50070/webhdfs/v1
Failed to access filesystem root 

do i must need hadoop configuration in hue? or i can just have configure beeswax and use hive with hadoop in other machine?

yoer commented 8 years ago

@romainr

is bug in hue docs?

i want to do a pull request :laughing: , but could not find cloudera.github.io project in github..

enricoberti commented 8 years ago

Where Hive is running you should have an HDFS running too, correct? You can read about the Hue configuration here: http://gethue.com/how-to-configure-hue-in-your-hadoop-cluster/

And for the pull request, this is the SDK doc file: https://github.com/cloudera/hue/blob/master/docs/sdk/sdk.md

:) thanks!

romainr commented 8 years ago

Fixed in https://github.com/cloudera/hue/pull/239, thanks!