<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass /
http://X.X.X.X:8080/loginRewriteEngine On
RewriteRule ^(.*/|)+(%20)+(.+)$ $1$2 [L]
# remove spaces from end or before /
RewriteRule ^(.+?)+(%20)+(/.*|)$ $1$2 [L]
# replace spaces by - in between
RewriteRule ^(^%20*)+(?:%20)+(.*)$ $1-$2 [L,R]
ProxyPassReverse /
http://X.X.X.X:8080/login</VirtualHost>