In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about how to avoid CDN caching mobile pages on PC. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
This problem does not occur if the PC side and the mobile side are the same set of code. "the problem is that PC and mobile are two sets of code, but share the same domain name. "
The configuration of using nginx is as follows: judge whether the mobile end is mobile according to UA, and follow different logic (to determine whether the mobile end of UA is prone to problems)
Location / {
/ / default PC side
Root / usr/local/website/web
# judge the UA and access the mobile terminal
If ($http_user_agent ~ * "(Android | webOS | iPhone | iPad | BlackBerry)") {
Root / usr/local/website/mobile
}
Index index.html index.htm
}
Solutions typically use Vary response headers to control how CDN caches different request headers.
"Vary: User-Agent can be used here, which means that if the User-Agent is different, the request is re-initiated instead of reading the page from the cache"
Vary: User-Agent
Of course, there are too many User-Agent, and there will be too much cache invalidation at this time.
A brief answer
Using Vary: User-Agent, caching is based on UA.
Vary: User-Agent
However, it is best not to do so. If there are two sets of codes for PC and mobile, two domain names are recommended for the following reasons
Nginx determines whether the mobile side is error-prone and unfriendly to cache. this is how to prevent CDN from caching mobile pages on PC. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.