7

I have a apache server that sits in front of my glassfish server. mydomain.com goes directly to my static files on apache, than if you hit the subdomain forum.mydomain.com it goes to the glassfish webapp forum/ at 127.0.0.1:8080/forum/. This proxy seems to work it takes me to the web app but all of the images are missing! Here is how I go my virtual host setup.

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName www.mydomain.com
    ServerAlias subdomain.mydomain.com mydomain.com
    DocumentRoot "/usr/local/apache/htdocs"

</VirtualHost>


<VirtualHost *:80>
    ServerName forum.mydomain.com
    # any logging config, etc, that you need
    ProxyPass / http://127.0.0.1:8080/forum/
    ProxyPassReverse / http://127.0.0.1:8080/forum/
</VirtualHost>

And in the access log this is what I am seeing.

[15/Jan/2012:03:28:02 +0000] "GET /forums/list.page HTTP/1.1" 200 12861
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/images/logo.jpg HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/styles/style.css?1326582403934 HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/images/icon_mini_recentTopics.gif HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/images/icon_mini_search.gif HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/images/icon_mini_members.gif HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/styles/en_US.css?1326582403934 HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/images/icon_mini_groups.gif HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/images/folder_big.gif HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/images/icon_mini_login.gif HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/images/whosonline.gif HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/images/icon_mini_register.gif HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/ping_session.jsp HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/images/folder_lock.gif HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/images/folder.gif HTTP/1.1" 404 1075
[15/Jan/2012:03:28:02 +0000] "GET /forum/templates/default/images/folder_new.gif HTTP/1.1" 404 1075

Any Ideas why the images are not working?

1
  • Where are the images located? Are they in /usr/local/apache/htdocs/templates/images or are they contained in the war?
    – d34dh0r53
    Jan 15, 2012 at 4:00

3 Answers 3

7

The code for the forum has the /forum/ path hardcoded in the HTML that it's sending to the client, or otherwise defined somewhere in its configuration. If you can change it to /, do so; otherwise, you can work around it in your Apache config:

<VirtualHost *:80>
    ServerName forum.mydomain.com
    ProxyPass /forum/ http://127.0.0.1:8080/forum/
    ProxyPassReverse /forum/ http://127.0.0.1:8080/forum/
    ProxyPass / http://127.0.0.1:8080/forum/
    ProxyPassReverse / http://127.0.0.1:8080/forum/
</VirtualHost>
1
  • You are AMAZING! It works! Jan 15, 2012 at 3:56
2

You can fixed it by placing the rewrite engine in the virtualhost.

RewriteEngine on
RewriteRule ^/forum/(images|javascripts|stylesheets)(.*) /forum/$1$2

For futher details refer here for rewrite engine

0

Based on @Mughil answer, i created below to help me use it for all the sites.

RewriteEngine on
RewriteRule ^/(.*)/(images|javascripts|stylesheets)(.*) /$1/$2$3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .