tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: AJP13 Connector and JKOptions
Date Thu, 19 Feb 2009 16:12:51 GMT
Pete Helgren wrote:

I really think you should re-read my previous answer.
I did a quick check on the page you indicated, using Firefox and it's 
LiveHttpHeaders add-on, and the result in summary is :

The first link to the page, ending in ..../ASAAP , works fine.
But subsequently, the browser is requesting URLs like :

GET /stylesheets/value.css HTTP/1.1
GET /images/bg_hdr_logo.gif HTTP/1.1

and getting consistently "404 Not found" responses.
And, these responses come from Apache, not Tomcat.
And, it is normal because :

In the configuration of mod_jk in Apache, either with the "JkMount" 
directives or the <Location> section that you tried, what you are 
actually saying to the Apache mod_jk module is :

'grab all requests that start with "/ASAAP", and send them to Tomcat to 
generate the content for them; then grab the content back as Tomcat 
generates it, and return that to the browser".
And that's fine and it also works fine for your starting page.

But, because of the way the relative links to stylesheets and images are 
, in the html page that Tomcat returns, the following requests from the 
browser are for URLs like above, /which do not start with "/ASAAP"/.
Thus, mod_jk could not care less about these, and lets Apache itself 
generate the content for them.
So now Apache is looking in its own DocumentRoot (probably something 
like "/var/www/docs", for an object that matches the path 
"/images/bg_hdr_logo.gif", and it does not find it.
So it returns a "404 not found".

Apache has no reason at all to go look for these objects in Tomcat's 
application directory (which is not at /var/www/docs but somewhere else) 
to go find these objects, and it will not.

Why does it work when you access Tomcat directly (on port 8080) ?

Because then, your browser is getting the initial page from the Tomcat 
at "http://yourhost:8080/ASAAP".  So when the browser sees, in that 
page, a relative link like "images/bg_hdr_logo.gif", it will issue a new 
request to
"http://yourhost:8080/images/bg_hdr_logo.gif" (thus to Tomcat).
And, presumably, your Tomcat configuration is such that it will find, in 
Tomcat's document root, an object that matches the URL 

To correct this, make the following experiment :
In the html page that Tomcat returns for the URL "/ASAAP", change the 
relative link to an image, from this :
<img src="images/bg_hdr_logo.gif" width="254" height="132" border="0">
to this :
<img src="/ASAAP/images/bg_hdr_logo.gif" width="254" height="132" 
and then try again.
It should not change anything for a direct access to Tomcat on port 8080.
But now, mod_jk at the Apache level will consider this a URL that it 
should handle, and will pass it to Tomcat.

(And if the above does not work, then I'm missing something at the level 
of your Tomcat configuration).

Now, the above does not solve all your problems, but it indicates where 
the issue is.  There are several possible solutions to the problem, but 
that depends on your setup and what ultimately you want to achieve.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message