Hello Hadoop community,
I am running a pseudo-distributed Hadoop 3.5.0 cluster on Debian 13. I am trying to use WebHDFS to upload files to the DataNode via a browser from a different origin. My configuration for CORS in core-site.xml is as follows: <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,PUT,DELETE,HEAD</value> </property> <property> <name>hadoop.http.cross-origin.allowed-headers</name> <value>X-Requested-With,Content-Type,Accept,Origin</value> </property> <property> <name>hadoop.http.cross-origin.max-age</name> <value>1800</value> </property> HDFS-site.xml: <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>dfs.permissions.enabled</name> <value>false</value> </property> When I try to upload a file from the browser, I get the following error: Access to XMLHttpRequest at 'http://debian:9864/webhdfs/v1/user/liuye/a.txt?op=CREATE&namenoderpcaddress=localhost:9000&createflag=&createparent=true&overwrite=false' from origin 'http://localhost:9870' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response. I have verified with curl that the OPTIONS request returns: HTTP/1.1 200 OK access-control-allow-origin: * access-control-allow-headers: accept access-control-allow-methods: PUT access-control-max-age: 1728000 content-length: 0 It seems that the DataNode does not respect the CORS configuration in core-site.xml, and the allowed headers are limited to 'accept' instead of '*'. Additional environment details: - OS: Debian 13 - Hadoop version: 3.5.0 - Java version: OpenJDK 17 - Mode: Pseudo-distributed Could you please confirm if this is a known limitation, or provide guidance on how to make DataNode WebHDFS fully respect CORS configuration? Thank you very much for your time and help. Best regards, Liuye 西巴君 [email protected]
