I'm trying to debug a problem to a web application that I didn't write and that I cannot alter, that seems to have serious encoding problems whenever it receives requests not in UTF8.

Now, to prove that this in fact is the problem (and to mitigate it while the actual web application is fixed) I was thinking about putting some kind of reverse proxy in front of it to work around the issue.

Its only work would be to receive requests, check if the Content Type is textual but not UTF8; in this case, it would have to re-encode the whole request body in UTF8, alter the Content Type and forward it upstream. In all other cases, leave everything intact. I don't even think that altering the reply would be necessary.

Now, is this possible to do with some of the usual reverse proxies running on Linux (Apache, Nginx, Varnish, ...), or I have to write my own filter?

  • I've never heard of such a thing. But if you can't change the web application, you need to have a chat with whoever can change it. Mar 17, 2017 at 7:46
  • @MichaelHampton: boy if I tried; let's say that they are seriously uncooperative and IMO not very competent; this issue have been going on for more than a year, they are replying erratically and they clearly have no idea of how to fix it. At this point, I'd be happy even if I manage to fix it "from the outside" by always providing their application UTF8 and stop corrupting user data, or at least to demonstrate them that this is indeed the problem so that they have some clue about how to fix it. Mar 17, 2017 at 8:03
  • But from a strictly technical standpoint, let's say that I want to build a web application whose backend only accepts/outputs UTF-8, and let the reverse proxy handle all the encoding nonsense (which really doesn't sound like a bad idea); is there a way to do it with common reverse proxies? Mar 17, 2017 at 8:07


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.