开发者

Http HEAD returning different Last-Modified dates on different servers for same resource, why?

We have a Java process that fetches resources over HTTP. I discovered that one resource was not pulling correctly even after a client had modified it. Digging into it I found that on the server the process is running the Last-Modified date of the resource does not match what I see when I view info from a browser. I then tried fetching it from a different server and my laptop and both of those showed the correct date.

I've since patched the process to allow the option to Ignore the header date for cases when it exists (but will be incorrect) but I would really love to know why this happens.

For reference here is a curl response from the Server that returns the incorrect info.

HTTP/1.1 200 OK
Server: Sun-ONE-Web-Server/6.1
Date: Fri, 23 Sep 2011 14:16:57 GMT
Content-length: 132
Content-type: text/plain
Last-modified: Wed, 15 Sep 2010 21:58:20 GMT
Etag: "84-4c91417c" 
Accept-ranges: bytes

And then the same request on a different server (also get the same results on my machine)

HTTP/1.1 200 OK
Server: Sun-ONE-Web-Ser开发者_如何学JAVAver/6.1
Date: Fri, 23 Sep 2011 14:18:47 GMT
Content-length: 132
Content-type: text/plain
Last-modified: Fri, 23 Sep 2011 01:20:43 GMT
Etag: "84-4e7bdeeb"
Accept-ranges: bytes

Both servers are running on Fedora 10.

Can anyone shed some light on this for me and how I might be able to fix this long term?


So you have 2 servers and both return different results, i.e. inconsistency problem (I can basically see this from Etag header)?

My first guess would be caching. Are the any caches active? Maybe the invaliation of cache doesn't work correctly or ttl (time-to-live) settings are too long.

As test have a try and fresh restart machine with stale data and see whether results change (usually during restart of systems most of the simple cache-setups are flushed).

Which kind of backend does the resource come from initially (database, file-system, 3rd party-service)?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜