简体   繁体   中英

Why are post requests not working and getting redirected?

I am a beginner with laravel and vue and I have a problem with routes when I make post requests to the server it tells me that the request was redirected, and I don't know where the problem is since the get requests work normally, please help me

vue code

 await this.form.post('/api/add_tramite/').then(response=>{
                console.log(response.data);
                this.fecthtramitesper();
                this.close();
          })

my route in laravel

Route::post('add_tramite',[tramiteController::class,'agregar_tramite']);

You should remove the trailing / in your URI.

await this.form.post('/api/add_tramite').then(response=>{

many servers redirect any url with trailing slash to the version without the slash for different reasons, one of them being SEO.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM