简体   繁体   English

使用POST或PUT时在Tomcat 7上出现403禁止错误

[英]403 Forbidden Error on Tomcat 7 When using POST or PUT

I have an AngularJS front end that receives data from a Java web service. 我有一个AngularJS前端,可以从Java Web服务接收数据。 Both of these live on a Tomcat 7 server. 这两个都位于Tomcat 7服务器上。 My application performs GET operations correctly. 我的应用程序正确执行GET操作。 However, when I am trying to save a new object or update an object, my POST and PUT operations return a 403 Forbidden error. 但是,当我尝试保存新对象或更新对象时,我的POST和PUT操作返回403 Forbidden错误。

From searching around, I found that Tomcat has PUT disabled and that it has to be turned on. 通过搜索,我发现Tomcat禁用了PUT,必须将其打开。 So I modified the web.xml file in the conf folder in the Tomcat directory and added the following code under the DefaultServlet: 因此,我修改了Tomcat目录中conf文件夹中的web.xml文件,并在DefaultServlet下添加了以下代码:

<init-param>
    <param-name>readonly</param-name>
    <param-value>false</param-value>
</init-param>

After this, the server was restarted. 此后,服务器将重新启动。 But I am still receiving the 403 error. 但是我仍然收到403错误。

Please let me know what other information I can include to help find what I am doing wrong. 请让我知道我可以提供哪些其他信息,以帮助发现我做错了什么。

The answer to my issue was discovered this morning. 我的问题的答案是今天早上发现的。 This was not a tomcat configuration error. 这不是tomcat配置错误。 Rather it was an authentication issue. 而是一个身份验证问题。 We use openam to authenticate on the servers and the PUT and POST options were not marked. 我们使用openam在服务器上进行身份验证,并且未标记PUT和POST选项。 Once those were checked, my web services worked correctly. 一旦检查完,我的Web服务便可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM