Question

All my express endpoints are getting redirected to GET requests on app platform

Posted December 29, 2021 108 views
DigitalOcean App Platform

I have an express project which I deployed to app platform and it currently has 2 endpoints - GET /trades and POST /trades.

Locally they both hit their respective handler code but when deployed to app platform i’m seeing that my POST request is getting redirected from a POST to a GET request.

Is this expected and is there a way to not have app platform do this?

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.

×
Submit an Answer
1 answer

Hey there!

Are those requests being issued over HTTP? App Platform forces HTTPS so if the request is made over HTTP it will be redirected which could change the request to a GET. I’d recommend making sure those POST requests are using HTTPS to not go through the HTTPS redirect.

Hope it helps!
Nate

  • Actually yes my requests are made over http and the redirect is to https.

    It seems that if I change my request to be https and also change the port from 8080 to 443, the request is successful.

    This seems like some undesired default behavior. I would think that if http requests are redirected to https, the behavior should be the same (i.e. GET redirected should still be GET, POST redirected should still be POST)

    Also if App Platform forces https, then why is http allowed at all?