Created 08-01-2024 08:45 AM
Hello,
I'm trying to acces Spark History UI through Apache Knox proxy but I get this error the following error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://<spark-host>:18080/api/v1/applications?limit=2147483647&status=completed. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 302.
I can' t find something related to CORS in Spark do you know how I could fix that ?
Thanks for your answer
Created 08-02-2024 03:34 AM
@TMauran
If you're using firefox, turn off enhanced tracking protection.
Created 08-02-2024 05:42 AM
Hello @cloude thank you for your answer, I disabled it and still got the error, tried on chrome too here is the error message in chrome,
Access to XMLHttpRequest at 'https://spark-host:18080/api/v1/applications?limit=2147483647&status=completed' from origin 'https://knox-host:8443' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Do you have any other idea ?
Created 08-02-2024 09:23 PM
Can you try setting below properties and restart history server ?
History Server Advanced Configuration Snippet (Safety Valve) for spark-conf/spark-history-server.conf"
spark.hadoop.http.cross-origin.allowed-origins = *
spark.hadoop.http.cross-origin.allowed-methods = GET, PUT, POST, OPTIONS, HEAD, DELETE
spark.hadoop.http.cross-origin.allowed-headers = X-Requested-With, Content-Type, Accept, Origin, WWW-Authenticate, Accept-Encoding, Transfer-Encoding
spark.hadoop.http.cross-origin.max-age = 180
Created 08-04-2024 07:13 PM
@TMauran Let me know if its resolve, please accept as solution so that it will be helpful for others as well.
Created 08-05-2024 12:01 AM
Hello @cloude even after adding those parameters I get the 302 error, wondering if the issue is not on the Knox part though now but thank you very much for your answer