Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Where are the images located? Are they in /usr/local/apache/htdocs/templates/images or are they contained in the war? –  d34dh0r53 Jan 15 '12 at 4:00
add comment

3 Answers

up vote 4 down vote accepted

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>
share|improve this answer
    
You are AMAZING! It works! –  EpicOfChaos Jan 15 '12 at 3:56
add comment

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

share|improve this answer
add comment

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.