Re: Is there a pref setting governing caching of async form submissions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18/01/2025 20:13, JEFFRY KILLEN wrote:
So it PHP caching form submissions"?

No. PHP does not cache requests / responses in this manner.

The most likely source of caching is the browser itself. There are several ways you can avoid this:

1) Use POST or PUT submission method. In general, by default: GET requests may be cached, POST and PUT (and DELETE) requests are not cached.

2) Append a random value to the query string, which changes with each request. The current (unix) timestamp is a commonly used value since it will always be unique (at least for submission not made in the same second). eg: /form-endpoint?nocache=48738743593 (some client-side libraries, such as JQuery have an option that does this).

The server-side doesn't need to do anything with this value, but the fact that it's there makes the browser see each request as a different one from any previous request.

3) Use appropriate HTTP headers (eg. Cache-Control - see links below)

Further reading:

* https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching
* https://developer.mozilla.org/en-US/docs/Glossary/Cacheable



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux