Welcome! Log In Create A New Profile

Advanced

Nginx and HTTP 304 Status Code

Posted by mrcuongnv 
Nginx and HTTP 304 Status Code
August 29, 2009 07:42PM
Hi all,

I have installed Nginx as a reverse proxy for my web server on a Debian "lenny: box. The back-end is Apache 2.2.

Normally, all the request come to Nginx will be forwarded to Apache. For some static files (jpg, bmp, js, css), Apache usually returns [b]304 status code[/b] to inform client's browser not getting those files because they are not changed.

I have just installed memcached and use memcache module of Nginx to cache static files (jpg, bmp, js, css) in the memory to free Apache from serving static content. I also run my own script to cache all static content in memcached because Nginx does not cache automatically.

Now, as I saw in my logs of the both Apache and Nginx, Apache only serves dynamic pages (php) and the remaining is served by Nginx. However, Nginx has not returned [b]304 status code[/b] any more. It always return [b]200 status code[/b], thereby, client's browser must be re-downloaded the static contents.

How can I configure my Nginx to detect the modified information which is sent from clients like the way Apache does? I do not want Nginx to re-send cached content to clients if clients have the latest version of that content.

Thank you very much!
Cuong
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 242
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready