By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

Resources not updating correctly

When admins delete comments, the original resource was not updating correctly.

Edited: 2012-03-02 13:15

By. BlueBoden

Note. The solution presented in this Article is a workaround, a real solution has been covered in the article named: Must-revalidate not working as expected

Brugbart was recently effected by a problem where admins would have to hit the update button in their browser, before the page would be reloaded properly after deletion of comments.

I tried to shift to a 303 (see other) redirect, as the 302 redirect really just means "found", this did first appear to solve the problem doing a quick test, but apparently it didn't doing a closer look.

URL Parameters to the rescue

Normally i just disallow get parameters where they ain't used, but now i had to find a way to allow them for logged-in users. This turned out to be easier then i thought, as it only called for a smaller modification to one of my scripts.

The URL Parameter that i had to add, was to be some sort of timestamp, to easily force a cache re-validation by the browser. I don't know why, but even when my headers are setup correctly, it doesn't seem to re-validate properly after updating a resource, in this case deleting comments.

It does however create some other problems (404 not found) when sharing a URL with a parameter. The easiest way to solve that, would likely be by the use of a Canonical URL Tag in the HTML source.

See also

  1. How to disallow URL parameters in PHP