Caching and Validation

Discuss general development subjects that are not specific to a particular version like the versioning control system we use or other infrastructure.
Post Reply
savemebarry
Registered User
Posts: 6
Joined: Mon May 25, 2015 1:31 pm

Caching and Validation

Post by savemebarry »

First of, it is well-known that:
It is important to specify one of Expires or Cache-Control max-age, and one of Last-Modified or ETag, for all cacheable resources. It is redundant to specify both Expires and Cache-Control: max-age, or to specify both Last-Modified and ETag.
Regarding validation, as far as I know phpBB is using Last-Modified and is not using any ETags (and that's good) and also Pragma is disabled, right?

Regarding caching, I have a few questions.

1. For which mime types do you set Expires headers and where can I find that code?

2. Do you set any Cache-Control: max-age headers, and if yes then for which file extensions and where can I find that code?

3. Also, do you think it would be a good idea to drop Expires and send only Cache-Control headers?

If both Expires and Cache-Control: max-age exist, Cache-Control has priority so its the max-age directive overrides the maximum age specified by the Expires header. Also, Cache-Control is http/1.1 standard and Expires is http/1.0. If the client browser does not support http/1.1 then Cache-Control will be ignored, but it’s unlikely that there is a browser that doesn’t support it. Expires depends on accuracy of user’s clock, so it’s mostly a bad choice (as most browsers support HTTP/1.1).

4. Finally, do you think it would be a good idea to allow the user to set the maximum age for different mime types or file extensions through the ACP and why yes/no?

savemebarry
Registered User
Posts: 6
Joined: Mon May 25, 2015 1:31 pm

Re: Caching and Validation

Post by savemebarry »

Anyone?

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: Caching and Validation

Post by brunoais »

Is this a phpBB development related question?

savemebarry
Registered User
Posts: 6
Joined: Mon May 25, 2015 1:31 pm

Re: Caching and Validation

Post by savemebarry »

brunoais wrote:Is this a phpBB development related question?

Yes it is. Google's PageSpeed and Yahoo's YSlow recommend to set expiration dates on all cacheable resources.

I do that in my server configuration, but I would like to know what phpBB currently does about it and what the devs think they should do. How about using Cache-Control max age?

I remember from some discussions that I read here that you have disabled Etags and Pragma. I want to know what else is done.

Also, I use this tool to see the HTTP response headers that phpBB is sending and I can see there are Expires headers.

I want to know if phpBB sets, for example, X seconds max age for text/html etc.

Where does phpBB set the Expires headers and for what types of resources?

User avatar
MattF
Extension Customisations
Extension Customisations
Posts: 675
Joined: Mon Mar 08, 2010 9:18 am

Re: Caching and Validation

Post by MattF »

This is not a phpBB problem or issue.

What you are talking about is stuff a sysadmin does to their entire website, usually within htaccess or htdev files. It's not phpBB's place to try to force server environment and configuration variables not directly related to its own functionality and/or security needs.

You can set this stuff up on your own server if you are concerned about such things:
https://github.com/h5bp/html5-boilerpla ... /.htaccess
Has an irascible disposition.

savemebarry
Registered User
Posts: 6
Joined: Mon May 25, 2015 1:31 pm

Re: Caching and Validation

Post by savemebarry »

VSE wrote:This is not a phpBB problem or issue.

What you are talking about is stuff a sysadmin does to their entire website, usually within htaccess or htdev files. It's not phpBB's place to try to force server environment and configuration variables not directly related to its own functionality and/or security needs.

You can set this stuff up on your own server if you are concerned about such things:
https://github.com/h5bp/html5-boilerpla ... /.htaccess

I am talking about cache headers here. They improve performance. How aren't they related to phpBB's functionality?

A sysadmin also does gzipping, but you guys thought you'd take care of that in the ACP. How is that different?

Now that I mentioned it, I'd also like to know which file types are getting compressed so that I won't add any of them in the mod_deflate (e.g. "application/javascript") if you are already taking care of it.

User avatar
JoshyPHP
Registered User
Posts: 381
Joined: Fri Jul 08, 2011 9:43 pm

Re: Caching and Validation

Post by JoshyPHP »

The forum software can only handle its own pages. Images, JavaScript, stylesheets, they are static files. They are not processed in PHP, they're not handled by phpBB.

Post Reply