If-modified-since header?

Google tells me I need to be hosted on a server that supports this header (and it makes sense from a Google perspective). My host tells me that his servers do support that header. Yet when I test my pages on his server, the tool I am using tells me no support. Can anyone here help me with this?

OK - for this to work, you need to insert a preamble on each PHP page -
<?php
$tsstring = gmdate('D, d M Y H:i:s ', $timestamp) . 'GMT';
$etag = $language . $timestamp;
$if_modified_since = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : false;
$if_none_match = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? $_SERVER['HTTP_IF_NONE_MATCH'] : false;
if ((($if_none_match && $if_none_match == $etag) || (!$if_none_match)) &&
($if_modified_since && $if_modified_since == $tsstring))
header('HTTP/1.1 304 Not Modified');
exit();
else
header("Last-Modified: $tsstring");
?>
This is from the discussion here -
http://stackoverflow.com/questions/1971721/how-to-use-http-cache-headers-with-php
which I had seen once, but it was not clear to me that this was to be used on the pages involved, and thought it might be a way to check the if-modified-since header from a PHP page instead of a way to make the page send the header.

Similar Messages

  • Safari seems not sending If-Modified-Since header for main address

    Not sure I'm in the appropriate forum but let's try (if there is more appropriate one please advise).
    When Safari requests a resource (page, image...) to a web server it doesn't provide If-Modified-Since header for the main resource of the request. That means the web server can't answer "resource not modified, use your cache". This is not the behavior of other browsers and not good in terms of performance for the web server as well as for the user.
    However Safari sends this If-Modified-Since for the sub-elements of the resource (e.g. images, css in a page...). Which is good.
    Is there a way to influence Safari's behavior to provide a If-Modified-Since for the main resource requested to the server?
    acama,

    Found out the answer.  IIS 6 does in fact steal "If-Modified-Since" and "If-None-Match" headers, but only on custom 404 redirects.  That's actually what I'm doing here (that'll teach me not to put details in a question when I think they're irrelevant -- actually I just forgot).
    Here's two discussions on the issue (they're using ASP, but apparently it's the same for ColdFusion):
    http://www.eggheadcafe.com/conversation.aspx?messageid=32839787&threadid=32839787
    http://www.webmasterworld.com/microsoft_asp_net/3935439.htm

  • ??? Using JSPs to Send Not-Modified-Since Header ???

    Hi all,
    In looking at past posts, I'm afraid I know the horrible answer
    to this issue but I thought I'd ask just in case I missed
    anything.
    Let me start by saying I'm using Tomcat v4.0.4 beta 3.
    As you know, when a client (usually a web browser) has a cached
    version of a resource (usually a web page) it can send an
    "If-Modified-Since" header to the HTTP server. The server
    compares the time/date stamp specified in the header with that of
    the requested resource. If the resource has not been modified
    since the time specified in the "If-Modified-Since" header, the
    server sends back a 304 (Not-Modified) response, effectively
    telling the client (usually a web browser) that its cached
    version of the resource is still valid.
    When writing a servlet, it's easy to handle this sort of
    scenario. The javax.servlet.http.HttpServlet class has a
    "service()" method. This method first checks if the incoming HTTP
    method is a GET. If it is, the "service()" method proceeds to
    call the "getLastModified()" method of the servlet. As a
    developer, you can override "getLastModified()" to return a long
    value representing the last time the requested resource was
    changed. Depending on the value returned by "getLastModified()"
    (note that -1 is returned if you don't override the method) the
    "service()" method may simply return a 304, Not-Modified response
    rather than calling the servlet's "doGet()" method.
    Now, the $18.32 Question: How do you ensure "getLastModified()"
    is called in JSP?
    No, you cannot simply do this:
    <%!
       public long getLastModified() {
          return xxx;
    %>The problem is that the above method will never be called by the
    container.
    I traced through some of the Tomcat/Catalina/Jasper code and it
    seems to me that the response code is being set to 200/OK very
    early on in the processing.
    I also took a cursory look at the JSP spec and didn't find any
    indication of setting a "Not-Modified" response code...so, I am
    thinking this is something that is (strangely) missing in the JSP
    specification. I have a JSP page that needs to update itself once
    per day. Therefore, it would be very handy to have the
    "getLastModified()" functionality enjoyed by servlet writers.
    Can anyone confirm this?
    Thanks...

    I've not come across this before, but like you I cannot find any mention of how to handle modification dates in the JSP spec. I can think of a couple of possible ways round this:
    1. Try to delegate the functionality to a servlet. You'd need to pass the JSPs modification date and handle the return. Seems messy and I haven't tried it.
    2. Add code to the JSP to read the headers directly and set the appropriate status code. e.g. at start of JSP:
    <%@page  import="java.util.*" %>
    <%
    if (request.getMethod().equals("GET")) {
       GregorianCalendar lastModified = new GregorianCalendar(2002, 01, 01); // use constant for testing
       response.setDateHeader("Last-Modified", lastModified.getTimeInMillis());  //always set header
       long modifiedSince = -1;
       try {
          modifiedSince = request.getDateHeader("If-Modified-Since");
       } catch (IllegalArgumentException iae) {
            // System.out.println(iae);
       if (modifiedSince != -1 && modifiedSince > lastModified.getTimeInMillis()) {     
          response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
          return;
    %>This would probably best be implemented as a custom tag if needed in more than one page.

  • Using the if-modified since http header

    I've a few questions regarding this header.
    1/ What is the point in using this header? Does it help with page ranking/hits?
    2/ Is if useful for static html pages or just for dynamic ones?
    3/ If it is useful for static pages, how do you add it? I.e exactly what code needs to added to the header? There seems to be quite a lot of discussion on the web about the merits or not of using this, but no examples of what code needs to be added.
    Any ideas?

    I hacked the Servlet myself so that it honors the if-modified-since header and returns HTTP-304 if the cached version is still ok.
    lg Clemens

  • If-Modified-Since HTTP Header

    Does anyone know if BC supports the if-modified-since http header? If it doesn't - how to add it to a BC webpage?
    In google guideline for SEo it states:
    Make sure your web server supports the If-Modified-Since HTTP header. This feature allows your web server to tell Google whether your content has changed since we last crawled your site. Supporting this feature saves you bandwidth and overhead.
    Thanks.

    I hacked the Servlet myself so that it honors the if-modified-since header and returns HTTP-304 if the cached version is still ok.
    lg Clemens

  • 304 If-modified-since

    The following seems to be doing what it should i.e. comparing a modified-since header against a database value and sending a 304 if not modified accordingly. It appears to work but I would like your comments since I'm new to doing this type of thing.
    void doConditionalGet(java.sql.Timestamp ts, HttpServletRequest request,
    HttpServletResponse response) {       
            response.setDateHeader("Last-Modified", ts.getTime());
            long modifiedSince = -1;
            try {
                modifiedSince = request.getDateHeader("If-Modified-Since");
                if (modifiedSince != -1 && modifiedSince >= ts.getTime()) {               
                    response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
                    return;
            } catch (IllegalArgumentException iae) {
                log.error(iae);
        }Thank you
    Niklas

    The following seems to be doing what it should i.e. comparing a modified-since header against a database value and sending a 304 if not modified accordingly. It appears to work but I would like your comments since I'm new to doing this type of thing.
    void doConditionalGet(java.sql.Timestamp ts, HttpServletRequest request,
    HttpServletResponse response) {       
            response.setDateHeader("Last-Modified", ts.getTime());
            long modifiedSince = -1;
            try {
                modifiedSince = request.getDateHeader("If-Modified-Since");
                if (modifiedSince != -1 && modifiedSince >= ts.getTime()) {               
                    response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
                    return;
            } catch (IllegalArgumentException iae) {
                log.error(iae);
        }Thank you
    Niklas

  • GetHttpRequestData missing "If-Modified-Since" and "If-None-Match"

    I'm using CF8 on IIS6/Win2003 Server.
    In my cfm I have:
    <cfset reqheaders=GetHttpRequestData().headers>
    <cfdump var="#reqheaders#">
    ...which gives:
    struct
    Accept
    text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Charset
    ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Accept-Encoding
    gzip,deflate
    Accept-Language
    en-us,en;q=0.5
    Cache-Control
    max-age=0
    Connection
    keep-alive
    Cookie
    CFID=[removed]; CFTOKEN=[removed]
    Host
    [my test server]
    Keep-Alive
    300
    User-Agent
    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
    But if I look at the actual headers being sent from my browser (using Firefox LiveHTTP add-on), it shows I am sending "If-Modified-Since" and "If-None-Match" headers.
    GET /path/to/cfmfile.cfm HTTP/1.1
    Host: [removed]
    User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Keep-Alive: 300
    Connection: keep-alive
    Cookie: CFID=[removed]; CFTOKEN=[removed];
    If-Modified-Since: Fri, 18 Sep 2009 01:18:19 GMT
    If-None-Match: ""0134E50193C69AD753656B0513FCB28C""
    Cache-Control: max-age=0
    Is there some reason IIS would "steal" those headers before handing over control to ColdFusion?  Or does GetHttpRequestData sometimes "miss" headers?  Other ideas?  Is there any other way I can get at the raw HTTP request from within ColdFusion?
    I'm at a loss.  Others have used the same process and no one seems to have this issue.
    (see: http://www.petefreitag.com/item/235.cfm or http://admin.mxblogspace.journurl.com/?mode=article&entry=1853 for examples)
    I've tried accessing the page using Internet Explorer instead.  It also is not showing those headers, but I have not sniffed IE's actual headers being sent so I can't be sure those headers are included (but I think they are, since IE implements conditional GET).

    Found out the answer.  IIS 6 does in fact steal "If-Modified-Since" and "If-None-Match" headers, but only on custom 404 redirects.  That's actually what I'm doing here (that'll teach me not to put details in a question when I think they're irrelevant -- actually I just forgot).
    Here's two discussions on the issue (they're using ASP, but apparently it's the same for ColdFusion):
    http://www.eggheadcafe.com/conversation.aspx?messageid=32839787&threadid=32839787
    http://www.webmasterworld.com/microsoft_asp_net/3935439.htm

  • How to modify "From" header when certain condition met on "Return-Path" header

    We are activating TLS enforcement (STARTTLS) between our customer domain (@tls.customer.com) and their business partner (@tls.partner.com) on internet MTA (Cisco ESA C370 running AsyncOS 8.0.1-023)
    Customer is managing their internal mail infrastructure and have user mail domains based on country. So for example user X in Switzerland will have sender address: [email protected]
    My understanding is that their are using IQ Suite software to re-write sender address into [email protected] to be able to enforce TLS based on this domain.
    So far so good until the business partner at receiving end mentioned that they receive reply-to: [email protected] but from: [email protected]
    And this will interfere with the policy at their end that require both sender header fields to be the same.
    My customer mentioned that they have modified both "From" and "Sender" fields using IQ Suite but somehow on our IronPort we are seeing both appears on "From":
    From: <[email protected]>, <[email protected]>
    And on message tracking I can see DKIM matching on [email protected] rather than on [email protected]
    Message 218480027 (51299 bytes) from [email protected] ready.
    10 Feb 2015 09:13:27 (GMT +01:00)     Message 218480027 matched per-recipient policy DEFAULT for outbound mail policies.
    10 Feb 2015 09:13:27 (GMT +01:00)     Message 218480027 is not signed. No domain key profile matches [email protected]
    10 Feb 2015 09:13:27 (GMT +01:00)     Message 218480027 successfully signed. DKIM ch.customer.com-DKIM matched ch.customer.com.
    10 Feb 2015 09:13:27 (GMT +01:00)     Message 218480027 queued for delivery.
    So I suspect that customer internal mail still has [email protected] on "From" header and [email protected] on "Return-path" header.
    The question is how can I modify "From" header to match that on "Return-path" before sending it to partner.
    Appreciate the feeback.

    From my tests and knowledge.
    We cannot manipulate the From: header to use the variable of the return-path/envelope sender.
    However if you know specifically what to re-write then we can specially re-write the From: header to a specific address.
    This is done as;
    Content filter or message filter condition set
    Action would be:
    insert-header("From", "[email protected]")
    This is all i can think of for this type of request

  • Verify that MBR hasn't been modified since last boot / overwrite it

    I need a way to check if the MBR and /boot partition have been modified BEFORE the system boots and if so, a way to overwrite them with "trusted" backups, again BEFORE the system boots.
    Is it possible to accomplish this by booting SOME SYSTEM (which one?) from a thumb drive, that checks the MBR and /boot partition for modifications and tells me if they have been modified and, ideally, offers to overwrite them with previosly stored, trusted versions?
    I searched the whole internet ... didn't find anything useful
    PLEASE HELP ME
    Edit:
    I know that this can be accomplished by booting some Live-CD and doing all manually. But it should be as minimal as it gets.
    Something like: It boots from thumb drive(sdb), checks MBR and boot partition of sda and if they haven't been modified since last boot, it should "chainload" the normal bootloader on sda.
    I don't want to mess around with assembler though.
    Last edited by FinallyHere (2011-03-16 10:51:03)

    What I would do is get the smallest linux distro I can find (or use LFS to make one) and make a bootable usb stick out of it (maybe with unetbootin.) Then it should be easy enough to write a script that uses dd and diff (and maybe md5sum to speed things up) to compare the boot sector and /boot and offer to rewrite them if necessary... And launch grub to boot from sda. The script could be launched automatically before login by tweaking the init scripts or running it as a daemon.
    Not a ready-made solution, and I don't know how scriptable grub really is, but since there was no answer yet...

  • JCAPS 5.12 - modifying SOAP header for webservice Invocation

    I am trying to call an external web service from JCAPS 5.1.2 and need to set a token in the SOAP header. I am able to do this in other client implementations, however, the methods to modify the header don't seem to be exposed within JCAPS 5.1.2 or I do not know how to find the methods.
    Has anyone tried this before?

    Hi Experts,
    I'm trying to protect a web service deployed in jcaps 5.1.1, using SAML assertions against an Access Manager 7/7.1, the web services clients are both, web and standalone applications, I also have read netbeans tutorials, that expose how to implement identity webservices using AppServer 9.1 + AccessManager 7.1 using the SAML Holder of key and other security mechanisms, but this implementation requiere modifications to the server.policy file to add support to SOAP message security providers and HttpServlet message security providers, the addition of a library called amwebservicesprovider.jar to the classpath suffix (this library implements the jsr-196 java Authentication Service Provider Interface for Containers) and aditional configuration required in the AM side that is not detailed in the tutorials.
    Could someone guide me on how to protect the acces to a web services deployed in the jcaps logicalhost based on AM roles assigned to users?
    Any help is aprecciated
    Juan

  • Modify Delivery header Text

    I have a requirement where I need to modify a header text of delivery and update it . The header text however is copied from STO (we are creating delivery from STO) through a copy routine.
    I need to know the user exit / badi / extension where I can implement this logic. The point where STO header text is copied from Delivery and I can acess this data before delivery save and update it.
    I tried many user exits but the text was not available until that point.

    Hi Neha,
    I would recommend you to create the copy of the routine xxx to 9xx that does the part of copying the text from STO to delivery and then after configuring the same routine in SPRO instead of the standard one.
    In the copied routine i.e. 9xx you can add the code and see the change happen.
    Please validate the same at your end as well, please come back if any inputs from my end are required on this.
    BR/Thanks
    Pranav Agrawal

  • How to Modify the Header/Footer that's created when printing to PDF?

    Hi all,
    How do I modify the header/footer that is added when I use the Adobe PDF printer in another application, like MS Word? Currently it adds the entire path of the file as the header, which is really annoying.
    I'm not talking about the Header/Footer command in Acrobat's "Document" menu. In fact, that command doesn't even recognise the header that's generated by the Adobe PDF printer.
    I'm using Acrobat Pro 8.1.3, btw.
    Thanks :)

    Generally you should set the whole look of the page in your application and then print to the Adobe PDF printer as you have been doing. If you are using a browser, there are header and footer commands for the printer that are typically set by the browser - those can be modified there. The PDF should look just like the preview in the application, that is the point of a PDF.

  • ERROR: Page is modified since you opened it!!

    Hi All,
    I have inserted  sharepoint 'view' in page and in another page i have called that page using ajax call with custom filter vales, so the view has been displayed without any problem.
    Now the problem is when i click the column name in the 'view' to 'sort' or 'filter' the page refreshes and throws the "ERROR:The page is modified since you opened it". I have tried this solution 
    <script language=”javascript” type=”text/javascript”>
    if(document.getElementById(“MSO_PageHashCode”))
    document.getElementById(“MSO_PageHashCode”).value=”";
    </script>
     but didnt work for me.
     Any other solution i need to try?

    Hello,
    Check the below blog:
    https://wordimpress.com/sharepoint-errors-warnings-and-problems-collection/ 
    Error: This Page has been modified since you opened it. You must open the page again.
    Solution: If this is continually happening while editing a page using the browser the page may be detached from the page layout. Open SPD and reattach the page to its page layout.
    Also check this if you have set the PostBackUrl of a LinkButton to the DefaultViewUrl of a list. 
    Solution: Using a HyperLink and setting the NavigateUrl to the DefaultViewUrl resolved the problem.
    Please remember to click Mark as Answer on the answer if it helps you.
    Cheers, Keerth
    Keerth R

  • OS X says that Compressor was modified since the code sign and won't let me launch it. Any reasoning behind this?

    Hello
    After updating Compressor to the most recent version (4.2), I get a message saying that Compressor was modified since the code sign and then won't let me launch it.
    I have tried reinstalling Compressor restarting and updating my computer.
    Any reasoning behind this problem??
    Thanks
    I am running OS X Yosemite 10.10.3 on a 2013 13inch MacBook Pro, 8GB RAM, 2.8GHz i7.

    Start the computer from the installation disk and perform Repair Disk and Repair Permissions using Disk Utility

  • External component modified since last VI save

    Hi !!
    it's been quite a bit that I'm stuck with this message "External component modified since last VI save". One explanation on the forum does not solve my problem.
    The problem is :
    I have a simple VI (enclosed) that I open on two different computers. Each time I save it on one computer and I open it on the second one Labview shows the mysterious message "External component modified..."... and I have to save the VI... Back to the first computer - same thing...
    Does anyone know where should I search to get rid of this message ?
    Thanks for any suggestions...
    Attachments:
    external_component_mod.vi ‏8 KB

    Yes, references are opened and closed the same way...
    In fact my problem is summarized in the VI I enclosed in my first post... There's one computer that has a different configuration from others here, and when I open that Vi on that computer Labview asks to save it before close (external component modified). I've checked the OS, the Excel version, ...

Maybe you are looking for

  • Can't fetch XMLType after getting first row

    Hi - when I call OCIDefineObject in a sub function, after getting the first row of XMLType value, the program can't fetch subsequent rows and stops. If I call OCIDefineObject in the same memory space of where the fetch call locates, it works out fine

  • Error when executing report in background

    Hi experts, I developed a new report. In that report I am getting data from KRMI transaction. For getting data from KRMI I have all the program and transaction and function modules under KRMI transaction to Z program, transcation and function modules

  • How do I get old Pictures back?

    I´ve just downloaded Apple ITunes and after installing and Configuring it suddendly all was gone. How do I get my old pictures back?

  • Table partitioning best practices

    Just looking for some ideas. We have a large information warehouse table that we are looking to partition on 'service_period' id. We have been requested to partition on every month of every year which right now will create approximately 70 partitions

  • Can't activate iphone after erasing it from Find my Iphone by error

    Hi, Earlier today I upgraded to IOs 7. Aftr that I erased the iphone from find my iphone (I have backup in the cloud). After turning on again, it requests: language, then country, then WiFi (no option for SIM code) and then it gives the message: "it