Support the ongoing development of Laravel.io →
API Requests

hi friends, I have created Laravel (ver.7) app for REST API:

in "api.php" is defined route:

Route::post('post','API\RegisterController@post');

and "RegisterController.php" has following code:

public function post(Request $request)  {
        return response()->json(['test' => 'TEST', 'value' => '1234']);
}

If I try this POST request on my local WAMP server via "Postman" utility:

POST  http://api/public/index.php/api/post

I get correct result:

{
    "test": "TEST",
    "value": "1234"
}

but if I am copying the same code to webhosting and try the same POST request (via "Postman"):

POST   bigoo.eu/subdom/API/public/index.php/api/post

I get error "405 Method Not Allowed".

But all other GET requests work properly. I cannot find where problem is ... please help me. Each useful tips appreciate

Last updated 2 years ago.
0
moderator

I see your url is http but I see that bigoo.eu redirects all trafic to https (the secure version) that is a good idea but will result in a redirect for your client. And then it will change from a POST to a GET request.

Side note: I see you have your debug mode on, that can give more information to the visitors then wanted and sometimes result in leaking sensitive information.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.