473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

header("Cache-Control: public") not working

I have read somewhere else in this newsgroup that the way to avoid the
message (Warning: Page has Expired blah, blah blah ... ) when one
presses the back button is to place the statement
header("Cache-Control: public");
at the top of the script.
I have done this but I still get the annoying message.
The session.cache_expire in php.ini is set to 180. I am using shared
SSL.
Thank you for you help

John
Jul 17 '05 #1
4 5747
jo******@fastermail.com (John) wrote in message news:<1a**************************@posting.google. com>...
I have read somewhere else in this newsgroup that the way to avoid the
message (Warning: Page has Expired blah, blah blah ... ) when one
presses the back button is to place the statement
header("Cache-Control: public");
at the top of the script.
I have done this but I still get the annoying message.


AFAIK, for that you need to use session_cache_limiter('private,
must-revalidate') if you're using session.

BTW, header("Cache-Control: public") doesn't make any sense at all
(IMHO) as you have to use client cache. I guess, it might be
"private".

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #2
ng**********@rediffmail.com (R. Rajesh Jeba Anbiah) wrote in message news:<ab**************************@posting.google. com>...
jo******@fastermail.com (John) wrote in message news:<1a**************************@posting.google. com>...
I have read somewhere else in this newsgroup that the way to avoid the
message (Warning: Page has Expired blah, blah blah ... ) when one
presses the back button is to place the statement
header("Cache-Control: public");
at the top of the script.
I have done this but I still get the annoying message.


AFAIK, for that you need to use session_cache_limiter('private,
must-revalidate') if you're using session.

BTW, header("Cache-Control: public") doesn't make any sense at all
(IMHO) as you have to use client cache. I guess, it might be
"private".


header("Cache-Control: private") does not seem to work either

John
Jul 17 '05 #3
jo******@fastermail.com (John) wrote in message news:<1a*************************@posting.google.c om>...
I have read somewhere else in this newsgroup that the way to avoid the
message (Warning: Page has Expired blah, blah blah ... ) when one
presses the back button is to place the statement
header("Cache-Control: public");
at the top of the script.
I have done this but I still get the annoying message.
AFAIK, for that you need to use session_cache_limiter('private,
must-revalidate') if you're using session.

BTW, header("Cache-Control: public") doesn't make any sense at all
(IMHO) as you have to use client cache. I guess, it might be
"private".


header("Cache-Control: private") does not seem to work either

What about session_cache_limiter('private, must-revalidate')??


--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #4
On 02 août 2004, Sir jo******@fastermail.com (John) claimed in
news:1a**************************@posting.google.c om:
I have read somewhere else in this newsgroup that the way to avoid the
message (Warning: Page has Expired blah, blah blah ... ) when one
presses the back button is to place the statement
header("Cache-Control: public");
at the top of the script.
I have done this but I still get the annoying message.
The session.cache_expire in php.ini is set to 180. I am using shared
SSL.
Thank you for you help

John

Well that's not true, you need to tell the browser that it can cache the
page so, you have to tell him that the page is valid for a certain time,

the header("Cache-Control: public"); just tell to intermediate proxies
that they are authorized to record the page in their cache.

what you need is to send headers like:

header("Cache-Control: private, max-age=3600");

##tell that it can keep the page for 1 hour in his cache (may be enough
to avoid the "page expire thing")
header("Expires: Wed, 04 Aug 2004 12:28:41 GMT");
##tell that he must check the page validity after this date

header("Last-Modified: Fri, 16 Jul 2004 22:07:59 GMT");
##tell that the page was modified on this date (used by proxies and
browsers to know if they need to recache the page or not)

so youre code would be:
<?php
$valid_date=3600;
$the_time=time();
$lastmodifie=filemtime(_SERVER["SCRIPT_FILENAME"]);

header("Cache-Control: private, max-age=$valid_date");
header("Expires: " . gmdate("D, d M Y H:i:s", $the_time + $valid_date) .
" GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodifie) . "
GMT");
?>
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mullin Yu | last post by:
hi, i have a web service that has file operations on Windows OS, and there may be a file concurrency issue if only one working directory e.g. c:\working therefore, i want to have a unique sub...
5
by: Martin Heuckeroth | last post by:
Hi We are working on a webservice application and are having some problems with the cookies and/or sessions. We have them working on our intranet but then its not working on the internet. We...
5
by: tshad | last post by:
I have been working with setting my drop boxes to allow double clicking to select an item. It worked fine until I made some changes. I then stripped the page down to the bare essentials to find...
8
by: jojobar | last post by:
Okay, I am trying to do is to test the webresource in 2.0 1. I created a new project with assembly name (and default assembly name) "Office". 2. I added the following to the AssemblyInfo.cs...
2
by: Don | last post by:
I'm having problems with intellisense, autocomplete, etc. suddenly not working in certain classes of a project I'm working on. All the options are set, and it all works fine for most classes, but...
9
by: MSDNAndi | last post by:
Hi, I have a set of simple webservices calls that worked fine using .NET Framework 1.0. I am calling a Java/Apache based webservices, the calling side is not able to supply a proper WSDL. ...
4
by: qbproger | last post by:
I'm developing a plugin for some software. The previous version of the software didn't require a start in directory to be set. This allowed me to leave the working directory to the default in the...
3
by: Jason Huang | last post by:
Hi, In our C# Windows Form application, we are using the SQL Server 2000 as the database server. The Database table MyTable has a field RegistrationDate which represents the Date a client comes...
0
by: WORKING IN FAITH | last post by:
three years I LOVE You Monica More options 1 message - Collapse all WORKING IN FAITH View profile More options Nov 13, 11:29 am three years I LOVE You Monica
3
by: lds | last post by:
On our server we have both applications that have been migrated to use v2.0 of the framework as well as apps that have not yet been migrated and still use 1.1. When I tried to deploy my v2.0 app...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.