It's a special case, I use an Apache mod_proxy in front of my tomcat and the Apache also add RequestHeader with mod_headers, thanks to mod_rewrite. If special characters are in the URI, they are "read" as ISO-8859-1. Even if I write a hard special value in the rule, like "hélo". If my conf file is saved as ISO-8859-1, it's OK but if the conf file is saved as UTF-8, it's KO (é become é at runtime). I didn't find where this encoding is configured. I try on both Windows and Linux Apache servers. Here the configuration file:
<VirtualHost *:80>
ServerName apache.convertigo.net
ProxyPass / http://httpbin.org/anything/
ProxyPassReverse / http://httpbin.org/anything/
RewriteEngine On
RewriteRule ^(.*)$ - [E=X_REQUEST_URI:%{REQUEST_URI},E=X_REQUEST_HOST:%{HTTP_HOST},E=X_HTTPS_STATE:%{HTTPS}]
RequestHeader set x-request-uri "%{X_REQUEST_URI}e" env=X_REQUEST_URI
RequestHeader set x-request-host "%{X_REQUEST_HOST}e" env=X_REQUEST_HOST
RequestHeader set x-https-state "%{X_HTTPS_STATE}e" env=X_HTTPS_STATE
RequestHeader set x-frontal "apache"
RequestHeader set x-helo "hélo"
</VirtualHost>
Here a testing URL that echo the URI (see X-Request-Uri) : http://apache.convertigo.net/hélo
And the result:
{
"args": {},
"data": "",
"files": {},
"form": {},
"headers": {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "fr-FR,en-US;q=0.8,fr;q=0.6,en;q=0.4",
"Cache-Control": "max-age=0",
"Connection": "close",
"Dnt": "1",
"Host": "httpbin.org",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36",
"X-Forwarded-Host": "apache.convertigo.net",
"X-Forwarded-Server": "apache.convertigo.net",
"X-Frontal": "apache",
"X-Helo": "h\u00c3\u00a9lo",
"X-Https-State": "off",
"X-Request-Host": "apache.convertigo.net",
"X-Request-Uri": "/h\u00c3\u00a9lo"
},
"json": null,
"method": "GET",
"origin": "217.167.129.14, 54.171.110.0",
"url": "http://apache.convertigo.net/anything/h\u00e9lo"
}
I expect that X-Request-Uri is "/h\u00e9lo" (like url) and not "/h\u00c3\u00a9lo".