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 » Mon May 25, 2015 1:50 pm

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 » Thu May 28, 2015 5:12 pm

Anyone?

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

Re: Caching and Validation

Post by brunoais » Fri May 29, 2015 12:20 pm

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 » Mon Jun 01, 2015 10:39 pm

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
VSE
Extension Customisations
Extension Customisations
Posts: 670
Joined: Mon Mar 08, 2010 9:18 am

Re: Caching and Validation

Post by VSE » Thu Jun 04, 2015 6:27 pm

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 » Fri Jun 05, 2015 10:58 am

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: 348
Joined: Fri Jul 08, 2011 9:43 pm

Re: Caching and Validation

Post by JoshyPHP » Fri Jun 05, 2015 11:21 am

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