Angular app on netlify: Page not found when angular is called via HTTP POST request

Hi!

i have a simple angular app delivered via netlify. At some point it redirects the user to a third-party payment provider and after successful payment, the user is redirected by the third-party provider back to the angular app. This redirect happens as a POST request.

But: My browser informs me, that netlifys response to this post request is a HTTP Status Code: 404

This page is showing:

Page Not Found
Looks like you've followed a broken link or entered a URL that doesn't exist on this site.

Back to our site

On netlify, all incoming requests are mapped to /index.html 200:

/* /index.html 200

I use the angular router. All normal GET requests are routed fine. The route for the POST request is /success (which, as a GET request, is handled normally by the router)

What can I do to stop netlify answering with 404 and instead make it redirect POST requests just like any other GET request?

kind regards!

hey elegon, sorry we have been kind of slow to respond to this one.

I think this thread might be useful for you:

This is an issue with Angular/POST/Netlify forms.

If you try searching the forums for “Angular post request” you will see a few other threads as well that might help you get this working again!

Hi perry,

thank you for responding, but this is not related to my case.
We do not use netlify forms. We do not send forms via angular either.
I of course found the post you mentioned before posting my issue, as I was desperately searching for a way to achieve this. I currently use a relay server for this - kind of reduces the benefit of netlify when I still have to do this…

kind regards

Our service does not accept POST requests, except to form response submission paths that you preconfigure using our forms features. We accept only HEAD/GET requests to all other URL’s, and return a 404 for POSTs to other paths.

So you’ll need to make the other service not try to POST to us, but instead, GET :slight_smile: If you can’t change it, you could have it POST to a function, that proxies to a GET or something like that, to work around this.