Request Method Post Not Supported Spring Security



  • There is a variety of common attacks that Spring Security helps you to protect against. It starts with timing attacks (i.e. Spring Security will always hash the supplied password on login, even if the user does not exist) and ends up with protections against cache control attacks, content sniffing, click jacking, cross-site scripting and more.
  • HTTP Status 405 - Request method 'POST' not supported - Spring Security. WARN o.s.web.servlet.PageNotFound - Request method 'POST' not supported 00:02:34.523 http.
  1. Request Method Delete Not Supported
  2. Request Method Put Not Supported
  3. Request Method Post Not Supported Spring Security Entry
  4. Request Method Post Not Supported Spring Security Check
  5. Request Method St Not Supported
Security

2020腾讯云限时秒杀,爆款1核2G云服务器99元/年!(领取2860元代金券),
地址:https://cloud.tencent.com/act/cps/redirect?redirect=1062

Problem accessing /jspringsecuritycheck. Reason: Request method 'POST' not supported I am using 'standard' Spring Security configuration via JDBC to user store, but it does not come to that point. I am suspecting a problem in the Spring Tiles configuration file.

2020阿里云最低价产品入口+领取代金券(老用户3折起),
入口地址:https://www.aliyun.com/minisite/goods

I created a spring mvc application using freemarker template as view part. In this tried to add a model using forms.I am also using spring security Here is the code

employee.ftl

employeeController.java

web.xml

Spring-security.xml

When click submit button it returns error `

HTTP Status 405 - Request method 'POST' not supported

` I gave POST method on both ftl and controller. Then why would this happen?

javaspringspring-mvcspring-security
| Request method post not supported

Request Method Delete Not Supported

this questionedited Dec 3 '14 at 10:55 asked Dec 3 '14 at 10:34 rohi 145 1 1 15 Which Spring version are you using? – Adriaan Koster Dec 3 '14 at 10:46 Can you show your web.xml? – Adriaan Koster Dec 3 '14 at 10:50 @AdriaanKoster i updated my question – rohi Dec 3 '14 at 10:55 |

4 Answers
4

---Accepted---Accepted---Accepted---Request method post not supported spring security checkRequest method st not supported

I am not sure if this helps but I had the same problem.

You are using springSecurityFilterChain with CSRF protection. That means you have to send a token when you send a form via POST request. Try to add the next input to your form:


|
this answer answered Dec 3 '14 at 11:18 crm86 707 4 26 1 thanks it works for me – Amir Feb 5 '15 at 20:04 That fix one part of the probelm, but have you investigated why a missing CSRF Token results in a '405 Request method 'POST' not supported' instead of an 403? – Ralph Mar 3 at 12:23 |

As far as I saw, the mentioned solutions didn't work for latest SpringSecurity. Instead of passing through with hidden you can also send it through the action URL like below:


|

Request Method Put Not Supported

this answeredited Apr 29 '15 at 20:10 answered Apr 29 '15 at 19:05 Shahab A 41 4 |

I found the solution. It is because of spring security Cross Site Request Forgery (CSRF) protection. It blocks the url. So i added an extra field inside the form.

Now it is working properly.


|
this answer answered Dec 3 '14 at 11:16 rohi 145 1 1 15 1 So you should accept prm's answer, right? – Adriaan Koster Dec 3 '14 at 12:49 @AdriaanKoster i haven't notice his answer. I found it before he post his answer. But Anyway now i ---Accepted---Accepted---Accepted--- his answer. – rohi Dec 4 '14 at 4:47 |

Try to replace:

Recommend:java - Spring MVC - HTTP Status 405 - Request method 'POST' not supported

have a simple upload form. The controller, i't a controller i've used a lot of times (never for a file upload though). @Controllerpublic class FileUploadController { @Autowired private HttpServletRequest request; @RequestMappi

with:

Unless you are using Spring 3.2

EDIT after seeing XML:

Try to move servlet-context.xml to your WEB-INF directory and rename it 'appServlet-context.xml'. Then remove the line:

Supported

Request Method Post Not Supported Spring Security Entry

From the contextConfigLocation in your web.xml.

The convention is that the context xml file is named '[servlet-name]-context.xml' where [servlet-name] is the name of the DispatcherServlet.

Also try to add a '/' to your form action, so:


|

Request Method Post Not Supported Spring Security Check


Request Method St Not Supported

this answeredited Dec 3 '14 at 11:09 answered Dec 3 '14 at 10:47 Adriaan Koster 10.6k 2 26 39 I am using spring version 3.2.3 – rohi Dec 3 '14 at 10:51 |

Recommend:java - HTTP Status 405 - Request method 'POST' not supported . Technology Used . Spring MVC and Spring security

to submit a page i am getting 'HTTP Status 405 - Request method 'POST' not supported .' Error. web.xml <xml version='1.0' encoding='UTF-8'><web-app xmlns='http://java.sun.com/xml/ns/javaee' xmlns:xsi='http://www.w3.org/2001/XMLSchem