title: Translation port causing Error 400: Reason: You're speaking plain HTTP to an SSL-enabled server port
body: <p>A port translation is configured on a firewall with public address to redirect an https request from <a href="https://customdomain.fr:8443" rel="nofollow noreferrer">https://customdomain.fr:8443</a> to <a href="https://localIP-apache-server" rel="nofollow noreferrer">https://localIP-apache-server</a>.</p>
  
  <p>The translation works well and the index.php page is displayed correctly.</p>
  
  <p>When i authenticate to the portal, the url is changed to http instead of https, and the following message appears:</p>
  
  <p>Bad Request
  Your browser sent a request that this server could not understand.
  Reason: You're speaking plain HTTP to an SSL-enabled server port.
  Instead use the HTTPS scheme to access this URL, please.</p>
  
  <p>If i replace http by https, the page is correctly displayed.</p>
  
  <p>I use a wamp server. In my httpd.conf there is 2 VirtualhHost, one for port 80, and one for port 443. Both port are listened.
  I tried to enable a RewriteRule in httpd.conf in VirtualHost 443:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteRule "^/?(.*)" "https://customdomain.fr:8443/$1" [L,R,NE]
  </code></pre>
  
  <p>But the error 400 still occurs. It seems that Apache send the Error before the request is read by the VirtualHost 443.</p>
  
  <p>So I tried to set the following code before VirtualHost 443 in httpd.conf:</p>
  
  <pre><code>ErrorDocument 400  https://customdomain.fr:8443/aaa/bbb
  </code></pre>
  
  <p>I do not have Error 400, but the displayed page is 
  <a href="https://customdomain.fr:8443/aaa/bbb/index.php" rel="nofollow noreferrer">https://customdomain.fr:8443/aaa/bbb/index.php</a> and not another page by example <a href="https://customdomain.fr:8443/aaa/bbb/order.php" rel="nofollow noreferrer">https://customdomain.fr:8443/aaa/bbb/order.php</a></p>
  
  <p>Do you know a way to display the requested page using ErrorDocument or another way to solve my issue please ?</p>