开发者

Apache Mod_cache configuration with Tomcat and Max-age directives

开发者 https://www.devze.com 2023-01-11 20:04 出处:网络
I have the following system configured: Tomcat -> Apache Now, I have some URLs on which I have Max-Age, LastModified and Etags set.

I have the following system configured:

Tomcat -> Apache

Now, I have some URLs on which I have Max-Age, LastModified and Etags set. My expectation is when Client1 makes a call to the server, the page should get served from tomcat, but should get cached in the mod_cache module of Apache. So that when next client makes a call, the page is served from Apache and it doesnt have to hit the Tomcat server, if the page is still fresh. If the page isnt fresh, Apache should make a Conditional Get to validate the content it has.

Can someone tell me if there is any fundamental mistake in this thinking? It doesnt happen to work that way. In my case, when client2 makes a call, it goes straight to the Tomcat server(not even a Conditional Get).

Is my thinking incorrect or my A开发者_StackOverflowpache configuration incorrect?! Thanks


The "What can be cached" section of the docs has a good summary of factors - such as response codes, GET request, presence of Authorization header and so on - which permit caching.

Also, set the Apache LogLevel to debug in httpd.conf, and you will get a clear view of whether or not each request got cached. Check the error logs.

You should be able to trace through what is happening based on these two.

0

精彩评论

暂无评论...
验证码 换一张
取 消