매우 이상한 문제가 있습니다. 우리는 앱을 프로덕션에 넣고 POST 요청 중 하나가 동일한 URL에 대한 GET 요청에 직접 따라가는 POST로 바뀌고 POST가 결코 백엔드 (Laravel)에서 수신되지 않습니다. 크롬 네트워크 탭에서는 그냥 GET처럼 보이지만 Burpsuite에서는 POST 요청을 볼 수 있습니다.Axios/XMLHttpRequest가 프로덕션 환경에서 POST 대신 GET을 보내고 있습니다.
담당하는 코드
async store() {
// This prints post
console.log(this.method());
await this.form[this.method()]('/api/admin/users/' + (this.isUpdate() ? this.id : ''));
if (!this.isUpdate()) {
this.form.reset();
}
},
form.post 방법 내용
return new Promise((resolve, reject) => {
axios[requestType](url, this.data())
.then(response => {
this.busy = false;
this.onSuccess(response.data);
resolve(response.data);
})
.catch(error => {
this.busy = false;
if (error.response.status == 400) {
return this.displayErrors(error.response.data)
}
this.onFail(error.response.data.errors);
reject(error.response.data);
});
});
301/302 리디렉션을 실행하는 것이 가장 가능성이 높습니다. 예를 들어 프로덕션 서버가 모든 'http'트래픽을'https'로 리디렉션하려고 시도하면'http'에 대한 모든 POST가'https'로 리디렉션됩니다. 그러나 GET 요청으로 변환됩니다. 약간 더 긴 설명을 보려면 [이 답변] (https://stackoverflow.com/questions/35399126/laravel-5-htaccess-https-redirect-on-post-routes-doesnt-work)을 참조하십시오. – patricus