当前位置:网站首页>The results of CDN node and source station are inconsistent
The results of CDN node and source station are inconsistent
2022-06-23 08:44:00 【Ice cream pieces】
Knowledge point
CDN As a distributed acceleration system , No matter how , Just as an acceleration , No changes will be made to the resource , The content returned to the customer should be consistent with the source site
Problem description
Client requests go through CDN The result of a node is different from that of a direct access to the origin
Problem analysis
When a client request arrives CDN After node , Will make the following judgments
Hit the cache and the cache data is not expired
CDN The node directly returns the result to the client
Miss cache
CDN Nodes forward client requests , At the same time HTTP Request Header Append some specific parameters to the request header , Final request origin
Schematic diagram
In some cases , Source station for HTTP Request Header The specific parameters appended to the request header will be handled differently , As a result, the result after the client request is processed is inconsistent with the direct access source station
for example : The origin will determine whether the request header contains Via Parameters , This confirms whether the request is from the proxy server , And then respond differently .
Solution
Proceed through the following two steps
- Locate the request parameter that caused this problem
- Modify the origin configuration or delete the problem parameters
Step one : Locate the request header parameter that caused this problem
Because the source station only returns different results for specific request header parameters , So you need to locate the specific parameter first . The positioning steps are as follows
Locally through the following curl The command directly accesses the origin , And record the returned results
curl -voa 'http://www.[$Your_Wesbite].com' -x [$Source_Server_IP]:[$Source_Server_Port]
- [$Your_Wesbite]: Refers to your website domain name .
- [$Source_Server_IP]: Refers to the public network of the origin server IP Address .
- [$Source_Server_Port]: Refers to the website port of the origin server , Usually this port is 80 or 443.
Locally through the following curl command , Attach Alibaba cloud CDN Node specific request header parameters , Then request the origin , And record the returned results
curl -voa 'http://www.[$Your_Wesbite].com' -x [$Source_Server_IP]:[$Source_Server_Port] -H 'header'
Contrast steps 1 And steps 2 Result , Check for inconsistencies
Consistent result . Please cycle through the steps 1 And steps 2, Also replace step 2 Request header parameter in , Until the results are inconsistent .
The results are different . Record the request header parameters with different results , Then proceed to the next step .
Step two : Modify the origin configuration or delete the problem parameters
When locating the specific request header parameter , Refer to the following two methods for processing :
Modify origin configuration
Please check the source station Web Server configuration , Whether there is a configuration with different responses according to different request headers . If there is , Please adjust according to the actual needs
stay CDN The console deletes the appended request header parameter
If the located request header parameter has no practical effect on your business , You can go to CDN The console configuration deletes the request header parameter . About how to delete a request header parameter reference
https://help.aliyun.com/document_detail/155768.htm?spm=a2c4g.11186623.0.0.611123896ux0Lc
Via: cn2**6.l1, vcache10.cn**36, l2cn**5.l2, cache28.l**35 Eagleeye-Traceid: 24689aa4*******58162753e Ali-Swift-Log-Host: test.***.cn Ali-Swift-Stat-Host: level2.test.***.cn X-Forwarded-For: 58.***.***.41 X-Client-Scheme: http Ali-Cdn-Real-Ip: 58.***.***.41 Ali-Swift-5Xx-No-Retry: on Cdn-Src-Ip: 127.0.0.1 Ali-Swift-Range-Cache: on
Important parameter description
- Via: The request went through CDN Node information .
- Ali-Cdn-Real-Ip: The client is real IP Address .
- Ali-Swift-Range-Cache: If you enable Range Back to the source ,CDN The node will append this parameter , See configuration for details range Back to the source .
https://help.aliyun.com/document_detail/27129.htm?spm=a2c4g.11186623.0.0.61112389BDrxq1
- X-Forwarded-For: The standard HTTP XFF Field .
Summary
User pass URL When accessing resources , When a real customer accesses resources, he does not care whether the resources of the node and the source site are consistent , It's usually cdn According to the manufacturer's customer feedback, the result of accessing the node is inconsistent with that of directly accessing the source station, or the node pulls resources back to the source and is inconsistent with that of the source station , When the user passes URL When accessing resources , If the node resource expires, the node forwards the client request , At the same time HTTP Request Header Append some specific parameters to the request header , Request origin , Source station for HTTP Request Header The specific parameters appended to the request header will be handled differently , As a result, the result after the client request is processed is inconsistent with the direct access source station . If the request header parameter is not required , It can be adjusted according to the situation , At the same time, pay attention to whether the domain name is configured gzip Compress 、 Picture conversion 、 Back to the source url rewrite , Generally, you can consider refreshing the nodes and source stations .
doubt
Under certain circumstances , Source station for HTTP Request Header The specific parameters appended to the request header will be handled differently
When a client request arrives CDN After node , Who will judge whether it hits or not cdn Node and whether the cache is expired
边栏推荐
- 开源技术交流丨批流一体数据同步引擎ChunJun数据还原-DDL功能模块解析
- Object. Defineproperty() and data broker
- Leetcode topic analysis set matrix zeroes
- Open source stealing malware mercurial found in the field for "educational purposes"
- 5、 Project management
- APM performance monitoring practice of jubasha app
- How to mine keywords and improve user experience before website construction?
- Arthas vmtool命令小结
- Subsets of leetcode topic resolution
- 6、 Web Architecture Design
猜你喜欢

走好数据中台最后一公里,为什么说数据服务API是数据中台的标配?

The first day of employment more than ten years ago

3. Caller 服务调用 - dapr

给你的win10装一个wget

Object.defineProperty() 和 数据代理

Basic use of check boxes and implementation of select all and invert selection functions

Open source technology exchange batch stream integrated data synchronization engine Chunjun data restore DDL function module analysis

Le rapport d'analyse de l'industrie chinoise des bases de données a été publié en juin. Le vent intelligent se lève, les colonnes se régénèrent

986. Interval List Intersections

Self organizing map neural network (SOM)
随机推荐
Azure Active Directory brute force attack
Driver Architecture & platform platform bus driver model
Implementing an open source app store with swiftui
Assembly (receive several n-digit decimal values (0~65535) from the keyboard and display their sum in different base numbers.)
[QNX Hypervisor 2.2用户手册]5.6.1 Guest关机时静默设备
MySQL common skills
XSS via host header
[QNX Hypervisor 2.2用户手册]6.2 网络
Tencent cloud account related
The most commonly used 5-stream ETL mode
Object. Defineproperty() and data broker
7-调色板-CALayer和触摸
鸿蒙读取资源文件
vector的深度剖析及模拟实现
RTSP/ONVIF协议视频平台EasyNVR启动服务报错“service not found”,该如何解决?
How to sort a dictionary by value or key?
Geoserver添加mongoDB数据源
Subsets of leetcode topic resolution
Why is the easycvr Video Fusion platform offline when cascading with the Hikvision platform? How to solve it?
APM performance monitoring practice of jubasha app