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


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

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more