Question

Laravel API project - unable to make POST requests

Hi everyone,

I’ve just deployed a Laravel project on App Platform. At first I defined the HTTP routes with “/api”, but then I modified the value and now the HTTP route’s values is “/”. The GET requests are working fine, but I am unable to make POST requests, I am getting 405 - "The GET method is not supported for this route. Supported methods: POST.

In my APP SPECS/services/ the routes are defined like this routes:

  • path: /

When checking the runtime logs I see that there was actually a GET request made

DOCUMENT_ROOT changed to 'public/'
[2022-11-28 19:31:15] Assuming 512MB of RAM
[2022-11-28 19:31:16] PHP memory_limit is 128M Bytes
[2022-11-28 19:31:16] Starting php-fpm with 4 workers...
[2022-11-28 19:31:17] Starting httpd...
[2022-11-28 19:31:18] Application ready for connections on port 8080.
[2022-11-28 19:31:48] 10.244.20.5 - - [28/Nov/2022:19:31:47 +0000] "GET /api/ceva HTTP/1.1" 405 93 "http://cezagora-api-ztafo.ondigitalocean.app/api/ceva" "PostmanRuntime/7.29.2

Any idea how I can fix this?

Thanks


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
November 29, 2022
Accepted Answer

Hi there,

Sounds like you are making the POST request to HTTP rather than HTTPS.

Can you try using the HTTPS URL in Postman instead?

Let me know how it goes!

Best,

Bobby