Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

steveleg's avatar

POST returns 405 while my routes are OK

Hi everyone, I have a weird problem. I try to log in with POST (username/password) to my application with this route

Route::post('login', 'AuthController@postLogin')->name('login.post');

I get a 405

The POST method is not supported for this route. Supported methods: GET, HEAD

In the local development environment everything is fine. In a production server environment I get this error.

I use Postman fos testing.

This is my route list

  • GET|HEAD | /
  • GET|HEAD | domains -GET|HEAD | login
  • POST | login
  • GET|HEAD | research-programs
  • GET|HEAD | researchers
  • GET|HEAD | researchers/profile
  • PUT | researchers/profile
  • POST | researchers/profile/picture
  • GET|HEAD | researchers/random
  • GET|HEAD | researchers/search
  • GET|HEAD | researchers/{id}
  • PUT | researchers/{id}
  • POST | researchers/{id}/picture
  • GET|HEAD | units

I added a GET /login route and dumped the \Illuminate\Http\Request object to see what I got.

These lines tell me that there is a redirect?

"REDIRECT_REDIRECT_REDIRECT_STATUS" => "200"

"REDIRECT_REDIRECT_REDIRECT_UNIQUE_ID" => "ZQ27NKn65K-juEgBrlpqKgAAAMw"

"REDIRECT_REDIRECT_REDIRECT_URL" => "/login/"

"REDIRECT_REDIRECT_REQUEST_METHOD" => "POST"

"REDIRECT_REDIRECT_REQUEST_SCHEME" => "https"

"REDIRECT_REDIRECT_REQUEST_URI" => "/login/?XDEBUG_SESSION_START=PHPSTORM"

"REDIRECT_REDIRECT_SERVER_PORT" => "443"

"REDIRECT_REDIRECT_SERVER_PROTOCOL" => "HTTP/1.1"

"REDIRECT_REDIRECT_STATUS" => "500"

...

"REDIRECT_REDIRECT_UNIQUE_ID" => "ZQ27NKn65K-juEgBrlpqKgAAAMw"

"REDIRECT_STATUS" => "500"

"REDIRECT_UNIQUE_ID" => "ZQ27NKn65K-juEgBrlpqKgAAAMw"

"REDIRECT_URL" => "/500.shtml"

"REMOTE_PORT" => "54560"

"REQUEST_METHOD" => "GET"

"REQUEST_SCHEME" => "https"

I've been struggling with this for hours now.

0 likes
5 replies
steveleg's avatar

Tha routes are API routes

I'm calling www.mydomain.com/login in HTTPS

Notdavis's avatar

Clear the route cache on the production server?

steveleg's avatar

Unfortunately we changed the server application and everything is fine now

Please or to participate in this conversation.