I just integrated Stripe in one of my Symfony project and evrything was working fine until I send the site on my hosting server (planethoster) AND I switched the environement to production mode.
My Stripe webhook is working well in dev mode locally, on the test server and on the prod server but once I change to prod mode in the .env file, the webhook give an error 503 Invalid Encoding.
I can't figure out what could be the difference between both cases.
Added to this, if I kill the production cache, the stripe webhook is delivered but after a couple of times, it start again to fail.
Any experience with this kind of strange reaction are more than welcome.
Thx in advance,
Xavier.
I already tried to modify the HTTP Response sent by my Symfony webhookController and force it to use the UTF-8 encoding but that doesn't changed anything.
As it works in dev mode and when the production cache is empty, I don't think the issue comes from my code. I already saw some other post about this talking about http redirect to https but again, it works in dev mode...
The problem seems to be with your PHP installation/configuration having the wrong
default_charsethere instead (doc). It's not about the encoding that you send in your response back to Stripe as they don't care about this information but instead about how your code processes Stripe's POST request. Your code seems to expect ISO-8859-1 and then errors because it gets UTF-8 from Stripe and crashes. You need to make sure that your code and your PHP config handles UTF-8 properly instead.