Don't let CDN cache your dynamic files

Source: Internet
Author: User
This is the case: we have a domain name on the CDN, it is to cache some of the IMG and JS and other static resources. But because of the business needs, we have added a dynamic PHP file to interface to accept some user feedback content.
And then today in this interface on the online a little bit of a problem I'm going to debug found, I changed the code after the refresh did not work, but my link change parameters on the code will work, I suspect that the link was cached by the CDN, but Ops told me that CDN does not cache dynamic files. Then I went to test to see the Nginx Log Refresh page does not have access to the log.
Finally, the operation of the link to the CDN vendor analysis, is indeed a cache. CDN over there configured to follow the policy of the source station, by default, we do not set PHP files do not cache, we have cached for 24 hours
We need to add a header to the Nginx configuration file location When we configure PHP not to cache.

//配置PHP不缓存.*\.(php|php5)?$ {        Cache-Control no-cache;    }//配置缓存2分钟location ~* ^.+\.(js|css)$ {        120s;    }

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above is introduced to do not let CDN cache your dynamic files, including aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.