The lesson of 405 Method Not Allowed in Nginx configuration

Encountered an error

In a file (avatar) upload, an error 405 Method Not Allowed occurred (there is no problem with the local and direct ip service servers), so the error was directly directed at Nginx

My configuration is as follows, the access domain name is forwarded to 9049, and the oss path is configured here to access the oss storage object file of
Insert picture description here
Alibaba Cloud. Baidu checked the information, and the general error means:

A 405 status code will appear on the target website of the httppost request. The reason is that most web servers such as Apache, IIS, Nginx, etc., do not allow static files to respond to POST requests , so change the post request to a get request.

Since I was uploading files, I added a configuration.
Insert picture description here
This configuration means that 405 appears, and it is directly converted to 200, but it does not solve the problem and is still invalid. (This configuration error_page 405 =200 http://$host$request_uri;405 Method Not Allowed under normal circumstances is no problem)

found mistake

And I pressed F11 of the browser where I uploaded the avatar, and found that the address of the resp error message returned was the address of the Alibaba Cloud oss ​​storage object: http://xijia-sz.oss-cn-shenzhen-internal.aliyuncs.com

At this time only to find, file upload path I provide the code for the domain name: /ossFile
the original configuration do is to take the path, so I rename the interfaces /aliOssFileon ok
Insert picture description here

Personal open source project (universal back-end management system) –> https://gitee.com/wslxm/spring-boot-plus2 , if you like, you can read this article. This is the end of this article. If you find it useful, please give a
thumbs up or pay attention to it. , Will continue to update more content from time to time... Thank you for watching!

Guess you like

Origin blog.csdn.net/qq_41463655/article/details/107777698
405