title: ProxyPass worker hostname too long in apache2 (2.4.7 Ubuntu 14.04 LTS), how to get around this?
body: <p>I have to setup apache2 as reverse proxy from an Internal AWS ELB. The URL of ELB is 85 characters. Setting it up with virtual host fails, as it gives an error</p>
  
  <pre><code>ProxyPass worker hostname (internal-elb-greater-than-64-character-url-that-fails-in-apache-aws.amazon.com) too long. 
  </code></pre>
  
  <p>This works very well if the ELB URL is less than or equal to 64 characters.</p>
  
  <p>The configuration looks like this in file <code>/etc/apache/sites-enabled/000-sites.conf</code> <em>(Actual ELB and Website's Name replaced)</em></p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      ProxyPreserveHost On
      ServerName www.mydomain.com
  
      ServerAdmin me@mydomain.com
      DocumentRoot /var/www/html
  
      RewriteEngine On
      RewriteCond %{HTTP:X-Forwarded-Proto} !https
      RewriteCond %{HTTP_USER_AGENT} !^ELB-HealthChecker.*
      RewriteRule . https://www.mydomain.com%{REQUEST_URI} [R=301,L]
  
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
  
      ProxyPass /test/ http://localhost:8080/
      ProxyPassReverse /test/ http://localhost:8080/
  
      ProxyPass / http://internal-elb-greater-than-64-character-url-that-fails-in-apache-aws.amazon.com/
      ProxyPassReverse / http://internal-elb-greater-than-64-character-url-that-fails-in-apache-aws.amazon.com/
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I have been able to setupsetup the same with nginx with the following configuration in file <code>/etc/nginx/nginx.conf</code></p>
  
  <pre><code>server {
      listen       80;
      server_name  localhost;
      root         /usr/share/nginx/html;
  
      #access_log  /var/log/nginx/host.access.log  main;
      location /test/ {
              if ( $http_x_forwarded_proto != 'https' ){
                      rewrite ^ https://www.mydomain.com$request_uri? permanent;
              }
              proxy_pass http://localhost:8080/;
      }
  
      location / {
              if ( $http_x_forwarded_proto != 'https' ){
                      rewrite ^ https://www.mydomain.com$request_uri? permanent;
              }
              proxy_pass http://internal-elb-greater-than-64-character-url-that-fails-in-apache-aws.amazon.com/;
      }
  
      location /elb-status {
              return 200;
      }
  
      # redirect server error pages to the static page /40x.html
      #
      error_page  404              /404.html;
      location = /40x.html {
      }
  
      # redirect server error pages to the static page /50x.html
      #
      error_page   500 502 503 504  /50x.html;
      location = /50x.html {
      }
  }
  </code></pre>
  
  <p>Nginx works as desired - with PING URL for health check modified.</p>
  
  <p>I was wondering what could be the equivalent configuration of in apache2 (2.4.7 Ubuntu 14.0 LTS).
  I tried this on apache2.4.9 in Fedora, still the same result.</p>
  
  <p>How can I get apache2 working, as we not considering nginx before the internal load balancer - it's not my decision.</p>