CSS, JS and other static contents are not loading for liferay 7 with Apache load balancer

1.1k views Asked by At

I am using Liferay 7.0 GA3 version and using Apache 2.4 as reverse proxy. Both servers installed on Windows 2012 R2 and facing problem while loading home page for liferay where all JS, CSS and other static components are not getting displayed and getting HTTP 500 error instead.

Apache config - (load balancing two Liferay servers running on two different VMs)

httpd.conf -

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so

RewriteEngine On

#forces everything under /web/guest/signup to secure if non-secure (https)
RewriteCond %{SERVER_PORT} =80
RewriteRule ^(.*)$ https://%{SERVER_NAME}:443$1 [R,L]

ProxyRequests Off

<Location / >
ProxyPass balancer://mybalancer stickysession=JSESSIONID
ProxyPassReverse "balancer://mybalancer" stickysession=JSESSIONID
</Location>

<Proxy balancer://mybalancer>
BalancerMember ajp://my.server.com:8009/ route=s1
BalancerMember ajp://my.server2.com:8009/ route=s2
</Proxy>

httpd-ssl.conf -

<VirtualHost _default_:443>
  SSLEngine on
  ServerName my.server.com:443
  SSLCertificateFile "${SRVROOT}/conf/ssl/lr-stage-server.crt"
  SSLCertificateKeyFile "${SRVROOT}/conf/ssl/lr-stage-server.key"
  DocumentRoot "${SRVROOT}/htdocs"
# DocumentRoot access handled globally in httpd.conf
    CustomLog "${SRVROOT}/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
    <Directory "${SRVROOT}/htdocs">
        Options Indexes Includes FollowSymLinks
        AllowOverride AuthConfig Limit FileInfo
    Require all granted
    </Directory>
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
</virtualhost>

Have changed tomcat server.xml on both the servers -

<Engine name="Catalina" defaultHost="localhost" jvmRoute="s1"> and
<Engine name="Catalina" defaultHost="localhost" jvmRoute="s2">

I am getting below errors on browser -

https://my.server.com/combo?browserId=other&minifierType=&theme…duct_menu_web_portlet_ProductMenuPortlet:%2Fcss%2Fmain.css&t=1478912808000 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
https://my.server.com/image/layout_set_logo?img_id=44936&t=1483591866720 Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Apache error logs -

[Wed Jan 04 23:15:15.954935 2017] [proxy:warn] [pid 5320:tid 1060] [client 10.99.59.8:61057] AH01144: No protocol handler was valid for the URL /o/classic-theme/css/main.css. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule., referer: https://my.server.com/
[Wed Jan 04 23:15:16.270960 2017] [proxy:warn] [pid 5320:tid 1064] [client 10.99.59.8:61062] AH01144: No protocol handler was valid for the URL /image/layout_set_logo. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule., referer: https://my.server.com/

If I try to access one of the failed Apache URL directly to another browser window, I am getting HTTP 500 error with following Respnse headers -

Request URL:https://my.server.com/o/mentions-web/css/mentions.css

Response Headers

Connection:close
Content-Length:530
Content-Type:text/html; charset=iso-8859-1
Date:Thu, 05 Jan 2017 05:20:15 GMT
Server:Apache/2.4.23 (Win64) OpenSSL/1.0.2h
Strict-Transport-Security:max-age=63072000; includeSubDomains

If I try the same URL that connects to Tomcat instead (so bypassig Apache), then I am getting HTTP 200 with following response headers -

Request URL:http://my.server.com:8080/o/mentions-web/css/mentions.css

Response Headers

Cache-Control:max-age=315360000, public
Content-Encoding:gzip
Content-Length:195
Content-Type:text/css
Date:Thu, 05 Jan 2017 05:20:52 GMT
ETag:"d187c5"
Server:Apache-Coyote/1.1
Set-Cookie:JSESSIONID=C41D0DA1E582219136FBBC8D8466F2F4.s1; Path=/; HttpOnly
X-Content-Type-Options:nosniff
X-Frame-Options:SAMEORIGIN
X-XSS-Protection:1

one thing to note is if I remove load balance config and try to connect one apache instance to one liferay server then everything is working fine.

ProxyPass / ajp://my.server.com:8009/
ProxyPassReverse / ajp://my.server.com:8009/

So looks like some configuration issue at apache side? Please help.

0

There are 0 answers