<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: REST API via Knox with Ranger permission get  307 Temporary Redirect message in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211094#M173036</link>
    <description>&lt;P&gt; &lt;A rel="user" href="https://community.cloudera.com/users/14200/asirna.html" nodeid="14200"&gt;@Aditya Sirna&lt;/A&gt;&lt;/P&gt;&lt;P&gt;i not sure, i copied Location url to another curl command but not success , i am checking if my command wrong or other error,&lt;/P&gt;&lt;P&gt;i will feedback my status after test. &lt;/P&gt;</description>
    <pubDate>Thu, 12 Oct 2017 15:25:49 GMT</pubDate>
    <dc:creator>sen_ke</dc:creator>
    <dc:date>2017-10-12T15:25:49Z</dc:date>
    <item>
      <title>REST API via Knox with Ranger permission get  307 Temporary Redirect message</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211088#M173030</link>
      <description>&lt;P&gt;Hi All, to fix knox rest api 404 not found error, i modify WEBHDFS url from {{webhdfs_service_urls}} to &lt;A href="http://My_NameNode:50070/webhdfs" target="_blank"&gt;http://My_NameNode:50070/webhdfs&lt;/A&gt;, it's worked.&lt;/P&gt;&lt;P&gt;then i using Ranger to control HDFS access permission, and configure Ranger HDFS and Knox plug-in...&lt;/P&gt;&lt;P&gt;i run curl command again, will display 307 Temporary Redirect!&lt;/P&gt;&lt;P&gt;i research about 307 message says maybe have name node HA and need add other name node url to Knox WEBHDFS setting,&lt;/P&gt;&lt;P&gt;but this is not match my ambari system because i have only one name node (no HA),&lt;/P&gt;&lt;P&gt;if any setting missing in Ranger or Knox?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 14:42:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211088#M173030</guid>
      <dc:creator>sen_ke</dc:creator>
      <dc:date>2017-10-11T14:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: REST API via Knox with Ranger permission get  307 Temporary Redirect message</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211089#M173031</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/45191/senke.html" nodeid="45191"&gt;@Sen Ke&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Hope you are trying to do some WEBHDFS operations. This is common for WEBHDFS. &lt;/P&gt;&lt;P&gt;Ex; If you want to upload a file using WEBHDFS , you have to make 2 curl calls. The response code of 1st curl call will be 307 redirect. The second call should be made to the Location Header obtained from the 1st curl call. &lt;/P&gt;&lt;H3&gt;Sample Curl Call to Create and Write to a File&lt;/H3&gt;&lt;UL&gt;&lt;LI&gt;Step 1: Submit a HTTP PUT request without automatically following redirects and without sending the file data.&lt;PRE&gt;curl -i -X PUT "http://&amp;lt;HOST&amp;gt;:&amp;lt;PORT&amp;gt;/webhdfs/v1/&amp;lt;PATH&amp;gt;?op=CREATE
                    [&amp;amp;overwrite=&amp;lt;true|false&amp;gt;][&amp;amp;blocksize=&amp;lt;LONG&amp;gt;][&amp;amp;replication=&amp;lt;SHORT&amp;gt;]
                    [&amp;amp;permission=&amp;lt;OCTAL&amp;gt;][&amp;amp;buffersize=&amp;lt;INT&amp;gt;]"
    &lt;/PRE&gt;The request is redirected to a datanode where the file data is to be written:&lt;PRE&gt;HTTP/1.1 307 TEMPORARY_REDIRECT
Location: &lt;A href="http://&amp;lt;DATANODE&amp;gt;:&amp;lt;PORT&amp;gt;/webhdfs/v1/&amp;lt;PATH&amp;gt;?op=CREATE" target="_blank"&gt;http://&amp;lt;DATANODE&amp;gt;:&amp;lt;PORT&amp;gt;/webhdfs/v1/&amp;lt;PATH&amp;gt;?op=CREATE&lt;/A&gt;.
Content-Length: 0
    &lt;/PRE&gt;&lt;/LI&gt;&lt;LI&gt;Step 2: Submit another HTTP PUT request using the URL in the Location header with the file data to be written.&lt;PRE&gt;curl -i -X PUT -T &amp;lt;LOCAL_FILE&amp;gt; "http://&amp;lt;DATANODE&amp;gt;:&amp;lt;PORT&amp;gt;/webhdfs/v1/&amp;lt;PATH&amp;gt;?op=CREATE..."
    &lt;/PRE&gt;The client receives a 201 Created response with zero content length and the WebHDFS URI of the file in the Location header:&lt;PRE&gt;HTTP/1.1 201 Created
Location: webhdfs://&amp;lt;HOST&amp;gt;:&amp;lt;PORT&amp;gt;/&amp;lt;PATH&amp;gt;
Content-Length: 0&lt;/PRE&gt;
&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The above URL is for normal WEBHDFS. To access it through Knox, you can use the knox url instead of HDFS. &lt;/P&gt;&lt;P&gt;You can read more about WEBHDFS &lt;A href="https://hadoop.apache.org/docs/r1.0.4/webhdfs.html"&gt;here&lt;/A&gt;  and Knox WEBHDFS &lt;A href="http://knox.apache.org/books/knox-0-7-0/user-guide.html#WebHDFS+Examples"&gt;here&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Aditya&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 15:04:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211089#M173031</guid>
      <dc:creator>asirna</dc:creator>
      <dc:date>2017-10-11T15:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: REST API via Knox with Ranger permission get  307 Temporary Redirect message</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211090#M173032</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/14200/asirna.html" nodeid="14200"&gt;@Aditya Sirna&lt;/A&gt;&lt;/P&gt;&lt;P&gt;thanks your reply, but i tried as below (try to put a test file )&lt;/P&gt;&lt;P&gt;curl -i -k -u user1:Hadoop -X PUT 'https://knoxHost:8443/gateway/default/webhdfs/v1/user1/test?op=CREATE'&lt;/P&gt;&lt;P&gt;get 307 Temporary Redirect, then type&lt;/P&gt;&lt;P&gt;curl -i -k -u user1:Hadoop -X PUT -T /test 'https://knoxHost:8443/gateway/default/webhdfs/v1/user1/test?op=CREATE'&lt;/P&gt;&lt;P&gt;is it right? i get 307 again&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 15:38:07 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211090#M173032</guid>
      <dc:creator>sen_ke</dc:creator>
      <dc:date>2017-10-11T15:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: REST API via Knox with Ranger permission get  307 Temporary Redirect message</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211091#M173033</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/45191/senke.html" nodeid="45191"&gt;@Sen Ke&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Looks like your 1st call and second call are for same url. Hit the 1st url and capture the response&lt;/P&gt;&lt;P&gt;Sample response &lt;/P&gt;&lt;OL&gt;
&lt;LI&gt;HTTP/1.1307 TEMPORARY_REDIRECT&lt;/LI&gt;&lt;LI&gt;&lt;STRONG&gt;Location&lt;/STRONG&gt;: &lt;A href="http://&amp;lt;xxx&amp;gt;:&amp;lt;yyy&amp;gt;/webhdfs/v1/&amp;lt;PATH&amp;gt;?op=CREATE" target="_blank"&gt;http://&amp;lt;xxx&amp;gt;:&amp;lt;yyy&amp;gt;/webhdfs/v1/&amp;lt;PATH&amp;gt;?op=CREATE&lt;/A&gt;.&lt;/LI&gt;&lt;LI&gt;Content-Length:0&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Now make the 2nd curl call to the url obtained from the response headers of 1st call ( Location Header highlighted in bold ) (ie.. &lt;A href="http://&amp;lt;xxx&amp;gt;:&amp;lt;yyy&amp;gt;/webhdfs/v1/&amp;lt;PATH&amp;gt;?op=CREATE...)" target="_blank"&gt;http://&amp;lt;xxx&amp;gt;:&amp;lt;yyy&amp;gt;/webhdfs/v1/&amp;lt;PATH&amp;gt;?op=CREATE...)&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Aditya&lt;/P&gt;</description>
      <pubDate>Wed, 11 Oct 2017 15:44:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211091#M173033</guid>
      <dc:creator>asirna</dc:creator>
      <dc:date>2017-10-11T15:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: REST API via Knox with Ranger permission get  307 Temporary Redirect message</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211092#M173034</link>
      <description>&lt;P&gt;Adding sample example here without knox. It would be similar with knox as well.&lt;/P&gt;&lt;PRE&gt;[root@xx user]# curl -i -X PUT "http://&amp;lt;namenode host&amp;gt;:50070/webhdfs/v1/tmp/testa/a.txt?user.name=livy&amp;amp;op=CREATE"
HTTP/1.1 307 TEMPORARY_REDIRECT
Cache-Control: no-cache
Expires: Tue, 26 Sep 2017 17:33:17 GMT
Date: Tue, 26 Sep 2017 17:33:17 GMT
Pragma: no-cache
Expires: Tue, 26 Sep 2017 17:33:17 GMT
Date: Tue, 26 Sep 2017 17:33:17 GMT
Pragma: no-cache
X-FRAME-OPTIONS: SAMEORIGIN
Set-Cookie: hadoop.auth="u=livy&amp;amp;p=livy&amp;amp;t=simple&amp;amp;e=1506483197716&amp;amp;s=dRvADKPG0lrenLje4fmEEdgChFw="; Path=/; HttpOnly
Location: &lt;A href="http://xxx:50075/webhdfs/v1/tmp/testa/a.txt?op=CREATE&amp;amp;user.name=livy&amp;amp;namenoderpcaddress=xxx:8020&amp;amp;createflag=&amp;amp;createparent=true&amp;amp;overwrite=false" target="_blank"&gt;http://xxx:50075/webhdfs/v1/tmp/testa/a.txt?op=CREATE&amp;amp;user.name=livy&amp;amp;namenoderpcaddress=xxx:8020&amp;amp;createflag=&amp;amp;createparent=true&amp;amp;overwrite=false&lt;/A&gt;
Content-Type: application/octet-stream
Content-Length: 0
Server: Jetty(6.1.26.hwx)

### second curl call with to Location obtained above
[root@xxx user]# curl -i -T /tmp/a.txt "http://xxx:50075/webhdfs/v1/tmp/testa/a.txt?op=CREATE&amp;amp;user.name=livy&amp;amp;namenoderpcaddress=xxx:8020&amp;amp;createflag=&amp;amp;createparent=true&amp;amp;overwrite=false"
&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Oct 2017 17:10:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211092#M173034</guid>
      <dc:creator>asirna</dc:creator>
      <dc:date>2017-10-11T17:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: REST API via Knox with Ranger permission get  307 Temporary Redirect message</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211093#M173035</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/45191/senke.html" nodeid="45191"&gt;@Sen Ke&lt;/A&gt;, Was this issue resolved. &lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 15:10:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211093#M173035</guid>
      <dc:creator>asirna</dc:creator>
      <dc:date>2017-10-12T15:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: REST API via Knox with Ranger permission get  307 Temporary Redirect message</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211094#M173036</link>
      <description>&lt;P&gt; &lt;A rel="user" href="https://community.cloudera.com/users/14200/asirna.html" nodeid="14200"&gt;@Aditya Sirna&lt;/A&gt;&lt;/P&gt;&lt;P&gt;i not sure, i copied Location url to another curl command but not success , i am checking if my command wrong or other error,&lt;/P&gt;&lt;P&gt;i will feedback my status after test. &lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 15:25:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211094#M173036</guid>
      <dc:creator>sen_ke</dc:creator>
      <dc:date>2017-10-12T15:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: REST API via Knox with Ranger permission get  307 Temporary Redirect message</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211095#M173037</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/14200/asirna.html" nodeid="14200"&gt;@Aditya Sirna&lt;/A&gt;&lt;/P&gt;&lt;P&gt;i can access webhdfs using curl now, but have a probelm&lt;/P&gt;&lt;P&gt;when curl via knox i only can use admin (-u admin:admin-password) and can't use other account or will reply HTTP/1.1 401 Unauthorized,&lt;/P&gt;&lt;P&gt;i has configured ranger and grand permission to other account (user1),&lt;/P&gt;&lt;P&gt;i can create/delete file with user1 in ambari file view via knox (user1 should have permission)&lt;/P&gt;&lt;P&gt;mycommand:&lt;/P&gt;&lt;P&gt;curl -i -k -u user1:Hadoop -X PUT 'https://knoxHost:8443/gateway/default/webhdfs/v1/user1/senfile1?op=CREATE'&lt;/P&gt;&lt;P&gt;folder permission:&lt;/P&gt;&lt;P&gt;drwxr-xr-x   - user1  hdfs            0 2017-10-05 11:08 /user1&lt;/P&gt;&lt;P&gt;do you know what the problem?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 09:34:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211095#M173037</guid>
      <dc:creator>sen_ke</dc:creator>
      <dc:date>2017-10-13T09:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: REST API via Knox with Ranger permission get  307 Temporary Redirect message</title>
      <link>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211096#M173038</link>
      <description>&lt;P&gt; &lt;A rel="user" href="https://community.cloudera.com/users/45191/senke.html" nodeid="45191"&gt;@Sen Ke&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Glad that it worked for you. Can you please accept the answer and start a new thread for this so that the thread will not get deviated from the main topic. Just tag me in the new thread along with the gateway.log file. I guess the user1 is not added under Advanced users-ldif in Knox advanced config.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Aditya&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2017 11:00:23 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/REST-API-via-Knox-with-Ranger-permission-get-307-Temporary/m-p/211096#M173038</guid>
      <dc:creator>asirna</dc:creator>
      <dc:date>2017-10-13T11:00:23Z</dc:date>
    </item>
  </channel>
</rss>

