简体   繁体   中英

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. Both of these live on a Tomcat 7 server. My application performs GET operations correctly. However, when I am trying to save a new object or update an object, my POST and PUT operations return a 403 Forbidden error.

From searching around, I found that Tomcat has PUT disabled and that it has to be turned on. So I modified the web.xml file in the conf folder in the Tomcat directory and added the following code under the 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.

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. Rather it was an authentication issue. We use openam to authenticate on the servers and the PUT and POST options were not marked. Once those were checked, my web services worked correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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