Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading