_redirect returns 500 Internal Server Error for only PUT and DELETE requests


I have successfully deployed my app and working fine : https://brave-euclid-b12d2c.netlify.com/

I have an API outside of Netlify and forwarding all api request via redirect configuration below

# The following redirect is intended for use with most SPAs that handle
# routing internally.
  from = "/api/*"
  to = "http://eduapphh.000webhostapp.com/api.php/:splat"
  status = 200

  from = "/test/*"
  to = "http://eduapphh.000webhostapp.com/test.php/:splat"
  status = 200

In the app, GET,POST requests are being forward to API and working perfectly but DELETE and PUT requests are not reaching to API server.

I have created /test endpoint for test purposes and API returns only request method of the request.

POST https://brave-euclid-b12d2c.netlify.com/test/1

GET https://brave-euclid-b12d2c.netlify.com/test/1

PUT https://brave-euclid-b12d2c.netlify.com/test/1
500Internal Server Error

DELETE https://brave-euclid-b12d2c.netlify.com/test/1
500Internal Server Error

On the API server, my .htaccess file is empty and nothing blocks PUT and DELETE requests

Should i do anything different?

Example request:
X-NF-Request-ID: d3b3bc98-102b-4f04-bf62-417d34e48a79-21594592


Hi Yavuz,

I do see an internal error on that request (thank you for including the screenshot of your x-nf-request-id!)

We’ll be able to work with the relevant dev team tomorrow to try to understand the error - I wouldn’t think you’re the first person to try PUT or DELETE over a proxy’d route, so I think that should work.

Should have some news to follow up with tomorrow!

Hi Chris,

Thank you for the update.
I have tried again. This time all my requests are being convert to GET request somehow.
Whether I send PUT, POST or DELETE request, i see only GET request on the other server side.

DELETE - https://brave-euclid-b12d2c.netlify.com/test/1

[REQUEST_URI] => /test.php/1
[SCRIPT_NAME] => /test.php
[PATH_INFO] => /1

X-NF-Request-ID: f430a356-f271-4d3c-a9ed-8c3afbc4a3bf-4604224


This is due to our migration described in this thread: Changes coming to Netlify site URLs

I think you should be able to call the function at https://brave-euclid-b12d2c.netlify.app/test/1 now and get identical results.

Our team is still investigating handling PUT/DELETE’s differently; we just reviewed with a senior developer a couple hours ago and he should have news for us tomorrow.

Hi Yavuz, seems your php page at the end of the proxy path does not return any body for PUT or DELETE requests, and this is in violation of the HTTP standard and is causing our proxying to fail to complete. Please make it return a body, and a proper Content-Length header for that body, and I think you’ll find things work better.

Hi Chris,

I realised that PUT and DELETE requests are block from the hosting company for the requests coming from outside. Thank you for your support. That helped a lot :slight_smile:


1 Like