[ 
https://issues.apache.org/jira/browse/HDFS-17040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18074615#comment-18074615
 ] 

ASF GitHub Bot commented on HDFS-17040:
---------------------------------------

EvanLiu2000 commented on PR #5721:
URL: https://github.com/apache/hadoop/pull/5721#issuecomment-4275168486

    Core-sites.xml :
     <property>
       <name>hadoop.http.filter.initializers</name>
       
<value>org.apache.hadoop.security.HttpCrossOriginFilterInitializer</value>
     </property>
   
     <property>
       <name>hadoop.http.cross-origin.enabled</name>
       <value>true</value>
     </property>
   
     <property>
       <name>hadoop.http.cross-origin.allowed-origins</name>
       <value>*</value>
     </property>
   
     <property>
       <name>hadoop.http.cross-origin.allowed-methods</name>
       <value>GET,POST,HEAD,PUT,OPTIONS,DELETE</value>
     </property>
   
   <property>
     <name>hadoop.http.cross-origin.allowed-headers</name>
     
<value>Origin,Accept,Content-Type,content-type,X-Requested-With,Authorization</value>
   </property>
   
     <property>
       <name>hadoop.http.cross-origin.max-age</name>
       <value>1800</value>
     </property>
    
   My Folder Permissions:
   liuye@debian:~/hadoop/hadoop-3.5.0$ hadoop fs -ls -R /
   drwxr-xr-x   - dr.who supergroup          0 2026-04-19 12:21 /ad
   
   When I attempted to upload a file to the `/ad` directory via the NameNode 
WebUI, an issue occurred:
   
   Access to XMLHttpRequest at 
'http://debian:9864/webhdfs/v1/ad/a.txt?op=CREATE&namenoderpcaddress=localhost:9000&createflag=&createparent=true&overwrite=false'
 from origin 'http://127.0.0.1:9870' has been blocked by CORS policy: Request 
header field content-type is not allowed by Access-Control-Allow-Headers in 
preflight response.
   
   May I ask how I should resolve this issue?




> Namenode web UI should set content type to application/octet-stream when 
> uploading a file
> -----------------------------------------------------------------------------------------
>
>                 Key: HDFS-17040
>                 URL: https://issues.apache.org/jira/browse/HDFS-17040
>             Project: Hadoop HDFS
>          Issue Type: Task
>          Components: ui
>            Reporter: Attila Magyar
>            Assignee: Attila Magyar
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.5.0
>
>
> When uploading a file using -WebHDFS- the Namenode web UI, it will set the 
> content type to application/x-www-form-urlencoded, as this is the default 
> used by jQuery
> https://github.com/apache/hadoop/blob/160b9fc3c9255024c00d487b7fcdf5ea59a42781/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/explorer.js#L516
> This causes knox to urlencode the request body so that uploading a CVS file 
> 1,2,3 will result 1%2C2%2C3.
> Instead of application/x-www-form-urlencoded I think the encoding should be 
> set to application/octet-stream.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to