[英]How to solve the ERROR 405 METHOD NOT ALLOWED?
我有一个托管在 nginx 下的前端和托管在 tomcat 下的后端。
我收到错误 405: Method not allowed 当我尝试登录应用程序时。
你会在这里找到配置文件 nginx.conf:
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;
gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
client_max_body_size 300M;
location / {
proxy_http_version 1.1;
proxy_request_buffering off;
expires off;
try_files $uri $uri/ /index.html;
}
location /api/app/ {
proxy_http_version 1.1;
proxy_request_buffering off;
expires off;
proxy_method GET;
proxy_pass http://192.168.57.129:8080/backend-1.0/api/app/;
}
}
}
我还在 web.xml 中添加了以下几行,以便让服务器接受 GET、POST 等请求:
<param-name>readonly</param-name>
<param-value>false</param-value>
当我启动 tomcat 时,与数据库的连接工作正常。 但错误仍然存在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.