How to resolve CSRF protection error while adding service through Ambari api
Short Description:
This article will describe on how to disable CSRF protection in Ambari.
Article
Adding service through ambari gives error as shown below -
[root@sandbox ~]# curl -u admin:admin -i -X POST -d '{"ServiceInfo":{"service_name":"STORM"}}' http://192.168.123.129:8080/api/v1/clusters/Sandbox/services
HTTP/1.1 400 Bad Request
Set-Cookie: AMBARISESSIONID=qraouzksi4vktobhob5heqml;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Content-Length: 107
Server: Jetty(7.6.7.v20120910)
{
"status" : 400,
"message" : "CSRF protection is turned on. X-Requested-By HTTP header is required."
You need to disable CSRF protection as mentioned below -
1.Login to ambari server using cli [superuser credentials]
vi /etc/ambari-server/conf/ambari.properties
2. Add below line at the bottom of the file
api.csrfPrevention.enabled=false
3. Restart ambari server
ambari-server restart
4. Try executing POST command again to add service and it should work
[root@sandbox ~]# curl -u admin:admin -i -X POST -d '{"ServiceInfo":{"service_name":"STORM"}}' http://192.168.123.129:8080/api/v1/clusters/Sandbox/services
HTTP/1.1 201 Created
Set-Cookie: AMBARISESSIONID=1t4c7yfbu64nw1nenrgplco7sd;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/plain
Content-Length: 0
Server: Jetty(7.6.7.v20120910)
Thanks.
How to resolve CSRF protection error while adding service through Ambari api的更多相关文章
- Creating a CSRF protection with Spring 3.x--reference
reference from:http://info.michael-simons.eu/2012/01/11/creating-a-csrf-protection-with-spring-3-1/ ...
- "cni0" already has an IP address different from 10.244.2.1/24。 Error while adding to cni network: failed to allocate for range 0: no IP addresses available in range set: 10.244.2.1-10.244.2.254
"cni0" already has an IP address different from 10.244.2.1/24. Error while adding to cni n ...
- How do I resolve the CodeSign error: CSSMERR_TP_NOT_TRUSTED?
How do I resolve the CodeSign error: CSSMERR_TP_NOT_TRUSTED? The Xcode build error titled "CSSM ...
- HTML form without CSRF protection,HTML表单没有CSRF保护
HTML form without CSRF protection =HTML表单没有CSRF保护 CSRF是伪造客户端请求的一种攻击,CSRF的英文全称是Cross Site Request For ...
- E-Business Suite 12.2 startCD 50 Install Fails with Fatal Error: TXK Install Service oracle.apps.fnd.txk.config.ProcessStateException: OUI process failed Cannot install Web Tier Utilities
在rhel7.2上,使用startCD 50安装ebs r12.2的使用,安装到38%的时候就报错,遇到了和以下文章类似的问题: http://www.cnblogs.com/abclife/p/49 ...
- WIN7 + IIS7 Service Unavailable HTTP Error 503. The service is unavailable.
在win7上开启IIS功能,进行网站发布. 但是开启IIS之后,打开默认网站都打不开,显示 Service Unavailable HTTP Error 503. The service is una ...
- adb shell出错“error: unknown host service”
已经测试,可用: 在命令行输入adb shell后输出如下错误: adb server is out of date. killing... ADB server didn't ACK * fail ...
- HTTP Error 503. The service is unavailable
网站运行一段时间后,突然所有的页面都报告以下错误: HTTP Error 503. The service is unavailable 经检查,应用程序池自动停止,可能是工作进程抛出的异常数超出限制 ...
- Adding Swagger to Web API project
Adding Swagger to Web API project. All source code for this series can be found here. When you creat ...
随机推荐
- java正则表达式验证金额
String reg_money = "\\d+(\\.\\d{1,2})?";// 金额正则,可以没有小数,小数最多不超过两位 Pattern pattern = Pattern ...
- Mysql中外键的 Cascade ,NO ACTION ,Restrict ,SET NULL
外键约束对子表的含义: 如果在父表中找不到候选键,则不允许在子表上进行insert/update 外键约束对父表的含义: 在父表上进行update/delete以更新或删除在子表中有一条或多条对应匹配 ...
- What is the best way to handle Invalid CSRF token found in the request when session times out in Spring security
18.5.1 Timeouts One issue is that the expected CSRF token is stored in the HttpSession, so as soon a ...
- Rest接口和Thymeleaf的两个坑
spring boot thymeleaf 热部署 在使用spring boot 开发的时候,使用了Thymeleaf 作为前端的模板开发,发现在调试过程中,改动了Thymeleaf模板后,需要重新启 ...
- 《Hadoop金融大数据分析》读书笔记
<Hadoop金融大数据分析> Hadoop for Finance Essentials 使用Hadoop,是因为数据量大数据量如此之多,以至于无法用传统的数据处理工具和应用来处理的数据 ...
- 你不知道的JavaScript--Item12 undefined 与 null
当讨论JavaScript中的原始数据类型时,大多数人都知道从String.Number到Boolean的基本知识.这些原始类型相当简单,行为符合常识.但是,本文将更多关注独特的原始数据类型Null和 ...
- OFFICE2007软件打开word时出现SETUP ERROR的解决方法
今天打开word时出现以下错误窗口: 在度娘上找了一下解决方案,原来每次打开word时都会启动一些无用的东西,找到这些东西的路径D:\Program Files\Common Files\micros ...
- 通过jenkins持续集成 github中的代码到 服务器。
前言 最近自己在探索springboot框架,了解到 jenkins 具有 自动我github 上带项目部署到 tomcat 中.于是决定先搭建一个jenkins 环境在继续研究. Jenkins简介 ...
- POJ_1269_Intersecting Lines_求直线交点
POJ_1269_Intersecting Lines_求直线交点 Description We all know that a pair of distinct points on a plane ...
- ios swift版 sqlite3详解
iOS中的SQLite3的封装与详细应用 SQLite是一个开源的嵌入式关系数据库,特点是易使用.高效.安全可靠.可移植性强. iOS中的本地持久化存储 NSUserDefault:一般用于存储小规模 ...