Home > Enterprise >  Why are post requests not working and getting redirected?
Why are post requests not working and getting redirected?

Time:06-09

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']);

CodePudding user response:

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.

  • Related