1. 程式人生 > >Request method 'GET' not supported的其它原因

Request method 'GET' not supported的其它原因

今天遇到一個奇葩錯誤

{
    "timestamp": 1540465525104,
    "status": 405,
    "error": "Method Not Allowed",
    "exception": "org.springframework.web.HttpRequestMethodNotSupportedException",
    "message": "Request method 'GET' not supported",
    "path": "/cno/disableBind"
}

百度了半天,一直以為是程式碼的原因,改來該去都不對。這是我的測試地址

後來檢視NGINX的日誌,才發現請求做了跳轉

118.26.72.21 - sales01 [25/Oct/2018:19:01:08 +0800] "POST /crm-cti/cno/disableBind?userName=test HTTP/1.1" 301 185 "-" "PostmanRuntime/7.3.0" "-"
118.26.72.21 - sales01 [25/Oct/2018:19:01:08 +0800] "GET /crm-cti/cno/disableBind?userName=test HTTP/1.1" 405 230 "http://dev.xuebastudy.com/crm-cti/cno/disableBind?userName=test" "PostmanRuntime/7.3.0" "-"

 原因很簡單配置的域名是https的,在請求的時候沒有帶上https://預設跳轉到http上,所以出現這樣的錯誤。至於具體的原因就不太清楚了。