Request Method Post Not Supported



二 Request method 'POST' not supported 进入正文,跟前端进行数据联调时,别人联调都正常,到联调我的接口(进行数据获取)就出现了问题。 下面进行异常场景还原(后端环境:Spring MVC4.0.5): 1、前端访问我这边的接口抛出错误码: 405 Method not allowed 。. Re: HTTP method POST is not supported by this URL swd847 Apr 5, 2016 9:41 PM ( in response to immobilia ) I think the only way to do this at the moment is to map a filter to the default servlet that wraps the request and changes the method to GET. Spring,Request method 'POST' not supported closed Ask Question Asked 7 years, 8 months ago. Active 2 years, 3 months ago. Viewed 180k times 25. This question is not reproducible or was caused by typos. It is not currently accepting answers.

If someone comes across an error page on your site, there’s a good chance they’ll get annoyed and leave. This can result in plenty of lost engagement and sales. One particularly common error to be aware of is the “405 Method Not Allowed” message.

This error can be tricky to navigate, as it indicates that something has gone wrong without telling you why it occurred. Fortunately, with a little effort and patience, you can be back up and running before long.

In this post, we’ll explain what a 405 error is and show you the different ways it can appear. We’ll then talk you through some of the ways you can fix this error on your WordPress site. Let’s get to it!

What the 405 Method Not Allowed Error Is

When you manage a website, it’s almost guaranteed that you’ll run into some kind of common issue eventually. Websites go down, links break, and pages load a little too slowly. Although these occurrences are common, leaving them unattended is likely to result in a poor user experience.

Unfortunately, some problems are more difficult to fix than others. Consider the 405 Method Not Allowed error message, for example. This is an HTTP response status indicating that a web browser has requested access to one of your site’s pages.

In this scenario, your web server has received and recognized the request, but has rejected the specific HTTP method it’s using. In practical terms, this means that the browser can’t access the page it requested. Your site’s visitors will see an error page, rather than the content they were looking for:

Google Chrome

Safari

405 Not Allowed Error Nginx in Safari

Firefox

Microsoft Edge

405 Not Allowed Error Nginx in Microsoft Edge

The 405 Method Not Allowed error shouldn’t be confused with the 404 Not Found error. A 404 tells you that the requested URL couldn’t be found or that it was entered incorrectly. A 405 error message, on the other hand, confirms that the requested page does exist (and the URL was input correctly), but an unacceptable HTTP method was used to make the initial request.

405 Method Not Allowed (Short Definition):

The 405 Method Not Allowed error occurs when the web server is configured in a way that does not allow you to perform a specific action for a particular URL. It’s an HTTP response status code that indicates that the request method is known by the server but is not supported by the target resource.

Support

Variations on the 405 Method Not Allowed Error

Although the 405 error message most commonly appears in the form we showed above, various web servers, operating systems, and browsers can present it in numerous ways. The actual cause of the issue is also likely to differ slightly from server to server, which can affect the way the error appears.

Here are just a few of the many different variations you might run across:

  • 405 Not Allowed
  • Method Not Allowed
  • HTTP 405 Error
  • HTTP Error 405 – Method Not Allowed
  • HTTP 405 Method Not Allowed

Regardless of how they appear, the trouble with 405 errors is that they can be difficult to solve. This is because they let you know that something has gone wrong, but they don’t tell you what the cause of the problem is. In most cases, it’s up to you to find the root cause and repair it if possible.

How to fix the 405 Method Not Allowed Error on Your WordPress Site (7 Possible Solutions)

Before we start discussing the possible solutions, you’ll want to create a backup of your site. This will give you something to fall back on if you make a mistake. Many web hosting providers include regular site backups as a part of their plans. If you have a hosting plan here at Kinsta, creating a backup is simple.

Once that’s out of the way, it’s time to begin the troubleshooting process. The methods we’ve outlined below are organized from most likely to fix the problem to least likely, so start from the top and work your way down to achieve the best results.

Without further ado, let’s get started with one of the easier steps on our list.

1. Check to See If You’ve Input the Correct URL

It may sound a little too simple but the most common cause of a 405 Method Not Allowed error is entering the wrong URL. Most web servers are tightly secured and designed to disallow access to improper URLs to prevent users from visiting the wrong pages (or trying to access pages that don’t exist).

Before going any further, therefore, double-check to ensure that you’ve entered the URL of the site you wish to visit correctly. It’s easier than you might think to make mistakes – such as forgetting a letter or misspelling a word. You may also find that simply refreshing the page could prompt it to load correctly.

2. Roll Back Any Recent WordPress Updates

Updates are wonderful things. They typically bring a wealth of exciting new features and can help to fix any ongoing bugs and patch security holes. However, despite their good intentions, updates can occasionally cause some issues.

If you updated WordPress just before the 405 Method Not Allowed error message started to appear, the new code could be the root of the problem. This also applies to any extensions or themes you may have recently upgraded – although we’ll focus more on that aspect in the next section.

Request method post not supported in windows 10

If you feel that an update might be at fault, it’s worth reverting back to the previous version of WordPress. As we’ve already touched on, make sure you have a full site backup ready before doing this – you don’t want to make any irreversible changes.

While you can do this manually, the easiest way to roll back WordPress updates is to use a plugin. There are many available options, although WP Downgrade is particularly effective. This plugin will largely automate the process, meaning that you’re less likely to make mistakes.

Having a tool like this in your arsenal also means that you can prevent similar issues from happening in the future. Of course, if rolling back the latest update doesn’t fix the problem, remember to re-update your site or restore your backup.

Minimize the potential for error with one unified management dashboard and site backups made simple (and accessible). Try Kinsta for Free.

3. Uninstall New Plugins and Themes

Plugins are an essential part of any WordPress website. They enable you to add a wealth of new features, and can even automate more complex processes. Themes are equally as important. Without them, you’d need a lot of complex coding (or an expensive developer) to create an aesthetically-pleasing site.

Unfortunately, just as with software updates, these extensions can sometimes create problems. This is because adding functionality to your site on any level completely changes the way it operates. There may be an issue with the plugin or theme you’re using, or a specific extension might conflict with another part of your site (or even your WordPress version).

As a result, you may find that uninstalling certain plugins or themes could help to fix the 405 Method Not Allowed error. To begin this process, you’ll need to navigate to the Plugins section of your WordPress dashboard. On this page, you should be able to see a complete list of all the plugins you have installed:

From here, you can begin to uninstall your plugins one at a time. After uninstalling each one, check your website to see if the error has been resolved. This process may take some time to complete, but it will enable you to pinpoint exactly which plugin is causing the problem (if any of them are at fault):

How to deactivate a WordPress plugin

Spring mvc request method post not supported

Once you’ve checked over your plugins, you can repeat this process with your active theme. If your theme or one of your plugins turns out to be the issue, you’ll want to either contact the developers, remove the plugin or theme, or look for a replacement. Here’s our guide on how to install a new WordPress theme.

4. Check for Any Unexpected Database Changes

Although the above step should resolve any plugin- or theme-related issues, it doesn’t guarantee that all changes made by your extensions have been fully reverted. This is especially true for many WordPress plugins. They are often given complete access to your database as soon as you hit Install, meaning that their changes go deeper than you might initially think.

Unless the developer explicitly codes against it, a plugin may be able to modify database records that don’t “belong” to it but are instead managed by WordPress itself. In this scenario, the plugin may not know how to revert those alterations to database records, so it will ignore them during the uninstallation process.

Diagnosing this particular problem can be difficult, but if you still suspect that a plugin or theme is the cause of the 405 Method Not Allowed error, checking your database directly is your best course of action. To do that, you’ll need to open your site’s database, and manually look through the tables and records modified by the extension. If you’re not sure what to look for, getting in touch with your developer is a smart idea at this point (as well as for the remaining steps on this list).

5. Confirm Your Server’s Configuration

Your website likely runs on a server that uses one of the two most popular server software options – Apache or Nginx. In fact, together they power 84% of the world’s web servers. Checking your web server software’s configuration files for any unintentional handling instructions may help to determine the root cause of the 405 Method Not Allowed error.

Request method post not supported spring boot

To determine which application your web server is using, you’ll want to look out for a key file. For example, if your web server is running Apache, you should be able to find an .htaccess file within the root directory of your website’s file system.

When your application is on a shared host, you’ll likely have a username associated with your particular account. If that’s the case, the application root directory can typically be found by following this path:

/home/public_html/

Therefore, the .htaccess file would be found at:

Request Method Post Not Supported Spring Boot

/home/public_html/.htaccess

Once you’ve located the .htaccess file, open it up in a text editor and look for lines that use Rewrite directives. These are part of the mod_rewrite module in Apache and define a text-based pattern that will be matched against all entered URLs. If a matching URL is requested by a visitor to your site, the RewriteRule will redirect the visitor appropriately.

To better demonstrate this, here is a simple RewriteRule that matches all incoming requests to https://kinsta.com and responds with a 405 Method Not Allowed error code:

As you can probably see, there’s a flag at the end of the rule marked R=405. This explicitly states that the response code should be 405, indicating to the user that the resource exists, but the provided HTTP method was not allowed. If you find any strange Rewrite directives in the .htaccess file that contain a similar instruction, try temporarily commenting them out using the # character prefix. You can then restart your web server, to see if your change has resolved the issue.

Remember, if you’re a client at Kinsta, we use Nginx servers, not Apache. You can reach out to our support team if you think something might be wrong with your Nginx config.

6. Look Through the Server-Side Logs

Post

Nearly every web application keeps some kind of server-side logs. Application logs usually comprise the complete history of everything the software has done – from the pages it’s requested, to the database results it provides.

Server logs are slightly different, as they’re related to the actual hardware that runs the application. They will often provide details about the health and status of all connected services, or even just the server itself.

Springboot request method post not supported

To find your WordPress server logs, you’ll want to connect to your site via Secure File Transfer Protocol (SFTP). In the root directory, you will see a folder called logs. Within this folder are your access logs, and your WordPress error logs. They should look a little something like this:

  • Access.log
  • Error.log

From there, you can begin to follow a similar process to that outlined in the previous step. Look through the logs and take note of anything that looks out of place (or ask your developer to do so). You can also refer to the codex for additional debugging information in WordPress.

7. Debug Your Application Code or Scripts

If none of the previous steps have done the trick, it may be a sign that there’s an issue with some custom code in your WordPress installation. The only way of determining whether this is the cause of the 405 Method Not Allowed error is to debug it.

Ideally, you’ll want to make a copy of the entire installation to an online or local development area – such as a staging site. From there, you can begin to conduct a step-by-step debugging process, which will vary depending on your site and its attached software.

Unfortunately, there’s no quick fix here. You’ll have to be prepared to put in the time to comb each section of your site for anything that looks out of place. Remember, however, that a fully-operational site is worth the hassle.

What to Do if None of These Solutions Work

Request Method Post Not Supported In Windows 10

If you’re still reading, it probably means that the solutions we’ve outlined above still haven’t fixed the 405 Method Not Allowed error. This is usually an indication that a more complex issue has occurred, and is unlikely to be something you can fix personally unless you’re a seasoned developer.

In this scenario, the best thing you can do is often to contact your hosting provider directly. You should have access to 24/7 customer support through a live chat or ticketing service. You may also be able to reach out to your host via email or phone, although opting for live chat is likely to offer a faster solution.

Summary

No matter how carefully-optimized your website might be, it’s nearly inevitable that you’ll encounter at least one error message at some point. It’s important to resolve the issue quickly when this happens, to keep visitors interested in your site. Fortunately, although the 405 Method Not Allowed error can be confusing, it’s often possible to fix it with a little troubleshooting.

Springboot Request Method Post Not Supported

Let’s recap the seven methods you can try in order to fix a 405 error on your WordPress site:

  • Check to ensure that you’ve entered the correct URL into the address bar.
  • Roll back any recent WordPress updates, to distinguish whether that’s causing the issue.
  • Uninstall any new plugins or themes one at a time.
  • Ensure that there haven’t been any unexpected database changes.
  • Confirm your server’s configuration.
  • Look through the server-side logs stored by WordPress.
  • Attempt to debug your application code or scripts.

Http Status 405 - Request Method Post Not Supported

Do you have any further questions about the 405 Method Not Allowed error? Or is there another commonly-encountered error message you’d like us to cover? Let us know in the comments section below!

Request Method Post Not Supported Spring Boot

If you enjoyed this article, then you’ll love Kinsta’s WordPress hosting platform. Turbocharge your website and get 24/7 support from our veteran WordPress team. Our Google Cloud powered infrastructure focuses on auto-scaling, performance, and security. Let us show you the Kinsta difference! Check out our plans