Repository: zeppelin Updated Branches: refs/heads/master 89b71ca03 -> 24a7e1810
ZEPPELIN-1168 Add http header X-Requested-By in post request to Livy for CSRF protection ### What is this PR for? Add http header X-Requested-By in post request to Livy for CSRF protection ### What type of PR is it? Improvement ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-1168 ### How should this be tested? enable csrf_protection on livy and check for "CSRF protection is enabled" message in the Livy logs. If this header is missing Livy server will send the following error message "Missing Required Header for CSRF protection." ### Questions: * Does the licenses files need update? n/a * Is there breaking changes for older versions? n/a * Does this needs documentation? n/a Author: Renjith Kamath <[email protected]> Closes #1181 from r-kamath/ZEPPELIN-1168 and squashes the following commits: 3bae7a5 [Renjith Kamath] ZEPPELIN-1168 Add http header X-Requested-By in post request to Livy Interpreter Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/24a7e181 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/24a7e181 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/24a7e181 Branch: refs/heads/master Commit: 24a7e1810f16dece1fe7534218a61d83fe93ee6e Parents: 89b71ca Author: Renjith Kamath <[email protected]> Authored: Wed Jul 13 16:41:21 2016 +0530 Committer: Prabhjyot Singh <[email protected]> Committed: Mon Jul 18 10:58:18 2016 +0530 ---------------------------------------------------------------------- livy/src/main/java/org/apache/zeppelin/livy/LivyHelper.java | 1 + 1 file changed, 1 insertion(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/24a7e181/livy/src/main/java/org/apache/zeppelin/livy/LivyHelper.java ---------------------------------------------------------------------- diff --git a/livy/src/main/java/org/apache/zeppelin/livy/LivyHelper.java b/livy/src/main/java/org/apache/zeppelin/livy/LivyHelper.java index fb83003..f84765d 100644 --- a/livy/src/main/java/org/apache/zeppelin/livy/LivyHelper.java +++ b/livy/src/main/java/org/apache/zeppelin/livy/LivyHelper.java @@ -348,6 +348,7 @@ public class LivyHelper { RestTemplate restTemplate = getRestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.add("Content-Type", "application/json"); + headers.add("X-Requested-By", "zeppelin"); ResponseEntity<String> response = null; if (method.equals("POST")) { HttpEntity<String> entity = new HttpEntity<String>(jsonData, headers);
