CN116208676A - Data back-source method, device, computer equipment, storage medium and program product - Google Patents
Data back-source method, device, computer equipment, storage medium and program product Download PDFInfo
- Publication number
- CN116208676A CN116208676A CN202310012413.0A CN202310012413A CN116208676A CN 116208676 A CN116208676 A CN 116208676A CN 202310012413 A CN202310012413 A CN 202310012413A CN 116208676 A CN116208676 A CN 116208676A
- Authority
- CN
- China
- Prior art keywords
- source
- domain name
- path
- data
- rewriting
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请涉及一种数据回源方法、装置、计算机设备、存储介质和计算机程序产品。所述方法包括:接收数据回源请求,所述数据回源请求携带有域名和回源路径;根据所述域名对所述回源路径进行重写得到重写回源路径,所述重写回源路径中的域名与源站中一级目录对应,所述回源路径为所述一级目录下的资源路径;根据所述重写回源路径查询所述源站得到对应的数据,并返回所查询到的数据。采用本方法能够对资源隔离,后续维护简单。
The present application relates to a data back-to-source method, device, computer equipment, storage medium and computer program product. The method includes: receiving a data back-to-source request, the data back-to-source request carrying a domain name and a back-to-source path; rewriting the back-to-source path according to the domain name to obtain a rewritten back-to-source path, and the rewritten back-to-source path The domain name in the source path corresponds to the first-level directory in the source site, and the return-to-source path is the resource path under the first-level directory; query the source site according to the rewritten back-to-source path to obtain the corresponding data, and return The queried data. By adopting this method, resources can be isolated, and subsequent maintenance is simple.
Description
技术领域technical field
本申请涉及云计算技术领域,特别是涉及一种数据回源方法、装置、计算机设备、存储介质和计算机程序产品。The present application relates to the technical field of cloud computing, and in particular to a method, device, computer equipment, storage medium and computer program product for data back-to-source.
背景技术Background technique
一个CDN(内容分发网络CDN(Content Delivery Network)是建立并覆盖在承载网之上,由遍布全球的边缘节点服务器群组成的分布式网络。CDN能分担源站压力,避免网络拥塞,确保在不同区域、不同场景下加速网站内容的分发,提高资源访问速度。常用于静态网页的部署)域名回源一个OSS bucket(OSS:对象存储OSS(Object Storage Service)是一款海量、安全、低成本、高可靠的云存储服务。Bucket:意为存储空间,是用户用于存储对象(Object)的容器,所有的对象都必须隶属于某个存储空间。存储空间具有各种配置属性,包括地域、访问权限、存储类型等。用户可以根据实际需求,创建不同类型的存储空间来存储不同的数据。)是传统静态网页部署常用的管理方式之一,该方式有访问速度快,网页管理更新方便等优势。但随着业务规模扩大,CDN域名变多,OSS bucket也会随之变多,导致管理碎片化,后期维护成本高。A CDN (Content Delivery Network) is established and covered on the bearer network, and is a distributed network composed of edge node server groups all over the world. The CDN can share the pressure of the source station, avoid network congestion, and ensure Accelerate the distribution of website content in different regions and scenarios, and improve the speed of resource access. It is often used in the deployment of static web pages) domain name back to the source of an OSS bucket (OSS: Object Storage OSS (Object Storage Service) is a massive, safe, low-cost , Highly reliable cloud storage service. Bucket: means storage space, which is a container for users to store objects (Object). All objects must belong to a certain storage space. Storage space has various configuration attributes, including region, Access rights, storage types, etc. Users can create different types of storage space to store different data according to actual needs.) is one of the commonly used management methods for traditional static web page deployment. This method has fast access speed and convenient web page management and update. Advantage. However, as the business scale expands and the number of CDN domain names increases, the number of OSS buckets will also increase, leading to fragmented management and high maintenance costs in the later period.
传统技术中,还存在多个CDN域名回源同一个OSS bucket,每个域名按约定使用一个OSS bucket的一级文件夹的管理方式。但是该方式中多个域名的资源没有完全隔离,比如A域名加B域名下的资源路径就能访问到B域名的资源,因此没有做到彻底的资源隔离,后期维护困难。In the traditional technology, there are still multiple CDN domain names back to the same OSS bucket, and each domain name uses the management method of a first-level folder of the OSS bucket according to the agreement. However, in this method, the resources of multiple domain names are not completely isolated. For example, the resource path under the domain name A plus the domain name B can access the resources of the domain name B. Therefore, complete resource isolation is not achieved, and later maintenance is difficult.
发明内容Contents of the invention
基于此,有必要针对上述技术问题,提供一种能够对资源隔离,后续维护简单的数据回源方法、装置、计算机设备、计算机可读存储介质和计算机程序产品。Based on this, it is necessary to provide a method, device, computer equipment, computer-readable storage medium, and computer program product capable of isolating resources and enabling simple subsequent maintenance to address the above-mentioned technical problems.
第一方面,本申请提供一种数据回源方法,所述方法包括:In the first aspect, the present application provides a data back-to-source method, the method comprising:
接收数据回源请求,所述数据回源请求携带有域名和回源路径;Receive a data back-to-source request, the data back-to-source request carries a domain name and a back-to-source path;
根据所述域名对所述回源路径进行重写得到重写回源路径,所述重写回源路径中的域名与源站中一级目录对应,所述回源路径为所述一级目录下的资源路径;Rewrite the origin-returning path according to the domain name to obtain a rewritten origin-returning path, the domain name in the rewritten origin-returning path corresponds to the first-level directory in the origin station, and the origin-returning path is the first-level directory The resource path under;
根据所述重写回源路径查询所述源站得到对应的数据,并返回所查询到的数据。Query the source site according to the rewritten back-to-source path to obtain corresponding data, and return the queried data.
在其中一个实施例中,所述根据所述重写回源路径查询所述源站得到对应的数据之前,还包括:In one of the embodiments, before querying the source site according to the rewritten back-to-source path to obtain the corresponding data, it also includes:
根据所述重写回源路径查询节点中是否缓存有对应的数据;Query whether there is corresponding data cached in the node according to the rewritten back-to-source path;
当所述节点中缓存有对应的数据时,从所述节点获取到对应的数据,并返回;When the corresponding data is cached in the node, the corresponding data is obtained from the node and returned;
当所述节点中未缓存有对应的数据时,则继续根据所述重写回源路径查询所述源站得到对应的数据的步骤。When there is no corresponding data cached in the node, continue to the step of querying the source station to obtain corresponding data according to the rewritten back-to-source path.
在其中一个实施例中,所述根据所述域名对所述回源路径进行重写得到重写回源路径,包括:In one of the embodiments, the rewriting the back-to-source path according to the domain name to obtain the rewritten back-to-source path includes:
改写所述回源路径得到带域名的初始回源路径;Rewriting the back-to-source path to obtain an initial back-to-source path with a domain name;
获取所述数据回源请求中的参数;Obtain the parameters in the data back-to-source request;
根据所述初始回源路径和所述参数进行重写到重写回源路径。Perform rewriting to the rewritten back-to-source path according to the initial back-to-source path and the parameters.
在其中一个实施例中,所述根据所述域名对所述回源路径进行重写得到重写回源路径之后,还包括:In one of the embodiments, after rewriting the back-to-source path according to the domain name to obtain the rewritten back-to-source path, it further includes:
在请求响应头信息中新增重写回源路径;Added a rewrite back-to-source path in the request response header information;
所述方法还包括:The method also includes:
在调试时,查询并显示所述请求响应头信息中的重写回源路径。When debugging, query and display the rewritten back-to-origin path in the request response header information.
在其中一个实施例中,所述方法还包括:In one embodiment, the method also includes:
接收新增域名请求,所述新增域名请求携带有至少一个新增域名;receiving a new domain name request, the new domain name request carrying at least one new domain name;
配置所述新增域名为同一个源站;Configure the newly added domain name to be the same origin site;
在所述源站中生成与所述新增域名对应的一级目录,并在所述一级目录下管理与所述新增域名对应的数据。A first-level directory corresponding to the added domain name is generated in the source site, and data corresponding to the added domain name is managed under the first-level directory.
在其中一个实施例中,所述配置所述新增域名为同一个源站之后,还包括:In one of the embodiments, after configuring the newly added domain name to be the same origin site, it also includes:
配置所述新增域名的回源路径重写规则;Configure the return-to-origin path rewriting rules for the newly added domain name;
所述根据所述域名对所述回源路径进行重写得到重写回源路径,包括:The rewriting of the back-to-source path according to the domain name to obtain the rewritten back-to-source path includes:
获取所述域名对应的回源路径重写规则;Obtain the rewriting rules of the back-to-source path corresponding to the domain name;
通过所述回源路径重写规则,根据所述域名对所述回源路径进行重写得到重写回源路径。According to the rewriting rule of the back-to-source path, the back-to-source path is rewritten according to the domain name to obtain a rewritten back-to-source path.
第二方面,本申请还提供一种数据回源装置,所述装置包括:In the second aspect, the present application also provides a device for returning data to the source, and the device includes:
数据回源请求接收模块,用于接收数据回源请求,所述数据回源请求携带有域名和回源路径;A data back-to-source request receiving module, configured to receive a data back-to-source request, the data back-to-source request carrying a domain name and a back-to-source path;
重写模块,用于根据所述域名对所述回源路径进行重写得到重写回源路径,所述重写回源路径中的域名与源站中一级目录对应,所述回源路径为所述一级目录下的资源路径;A rewriting module, configured to rewrite the back-to-source path according to the domain name to obtain a rewritten back-to-source path, the domain name in the rewritten back-to-source path corresponds to the first-level directory in the source station, and the back-to-source path is the resource path under the first-level directory;
回源模块,应用于根据所述重写回源路径查询所述源站得到对应的数据,并返回所查询到的数据。The back-to-source module is used to query the source station to obtain corresponding data according to the rewritten back-to-source path, and return the queried data.
第三方面,本申请还提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述的任意一个实施例中的方法的步骤。In a third aspect, the present application further provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of the method in any one of the above embodiments when executing the computer program.
第四方面,本申请还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述的任意一个实施例中方法的步骤。In a fourth aspect, the present application further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method in any one of the above-mentioned embodiments are implemented.
第五方面,本申请还提供一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现上述的任意一个实施例中方法的步骤。In a fifth aspect, the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the method in any one of the above-mentioned embodiments are implemented.
上述数据回源方法、装置、计算机设备、存储介质和计算机程序产品,在接收到数据回源请求后,根据所述域名对所述回源路径进行重写得到重写回源路径,由于各个域名共用一个源站,且与源站中一级目录对应,这样不同的域名不需要按约定使用一个一级目录,实现了文件的隔离,且回源路径为所述一级目录下的资源路径,这样不同的数据的域名一样,其回源路径也不相同,因此各个域名下的资源互不相关,不会出现A域名下能访问到B域名资源的问题,且由于仅适用了一个源站,以一级目录进行域名的划分,规则简单明了,也便于后期的管理和维护。The above data back-to-source method, device, computer equipment, storage medium and computer program product, after receiving the data back-to-source request, rewrite the back-to-source path according to the domain name to obtain the rewritten back-to-source path, because each domain name Share a source site and correspond to the first-level directory in the source site, so that different domain names do not need to use a first-level directory as agreed, which realizes the isolation of files, and the path back to the source is the resource path under the first-level directory. In this way, the domain names of different data are the same, and their back-to-source paths are also different, so the resources under each domain name are not related to each other, and there will be no problem that A domain name can access B domain name resources, and because only one source site is applicable, Domain names are divided into first-level directories, the rules are simple and clear, and it is also convenient for later management and maintenance.
附图说明Description of drawings
图1为一个实施例中数据回源方法的应用环境图;Fig. 1 is an application environment diagram of the method for data back-to-source in an embodiment;
图2为一个实施例中数据回源方法的流程示意图;Fig. 2 is a schematic flow chart of a data back-to-source method in an embodiment;
图3为一个实施例中回源请求经边缘脚本改写回源路径后回源同一个OSS bucket的流程图;Fig. 3 is a flow chart of returning to the same OSS bucket after the back-to-origin request is rewritten by the edge script in an embodiment of the back-to-origin path;
图4为另一个实施例中数据回源方法的流程示意图;FIG. 4 is a schematic flow chart of a data back-to-source method in another embodiment;
图5为一个实施例中的重写步骤的流程图;Figure 5 is a flow chart of the rewriting steps in one embodiment;
图6为一个实施例中数据回源装置的结构框图;Fig. 6 is a structural block diagram of a data back-to-source device in an embodiment;
图7为一个实施例中计算机设备的内部结构图。Figure 7 is an internal block diagram of a computer device in one embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not intended to limit the present application.
本申请实施例提供的数据回源方法,可以应用于如图1所示的应用环境中。其中,终端102通过网络与服务器104进行通信,服务器104与源站106进行通信。The data back-to-source method provided in the embodiment of this application can be applied to the application environment shown in FIG. 1 . Wherein, the terminal 102 communicates with the
其中,终端102基于域名和回源路径生成数据回源请求,并将数据回源请求发送至服务器104,服务器104根据域名对回源路径进行重写得到重写回源路径,重写回源路径中的域名与源站中一级目录对应,回源路径为一级目录下的资源路径,并根据重写回源路径查询源站106得到对应的数据,并返回所查询到的数据至终端102。Among them, the terminal 102 generates a data back-to-source request based on the domain name and the back-to-source path, and sends the data back-to-source request to the
这样服务器104在接收到数据回源请求后,根据所述域名对所述回源路径进行重写得到重写回源路径,由于各个域名共用一个源站,且与源站中一级目录对应,这样不同的域名不需要按约定使用一个一级目录,实现了文件的隔离,且回源路径为所述一级目录下的资源路径,这样不同的数据的域名一样,其回源路径也不相同,因此各个域名下的资源互不相关,不会出现A域名下能访问到B域名资源的问题,且由于仅适用了一个源站,以一级目录进行域名的划分,规则简单明了,也便于后期的管理和维护。In this way, after receiving the data back-to-source request, the
其中,终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑、物联网设备和便携式可穿戴设备,物联网设备可为智能音箱、智能电视、智能空调、智能车载设备等。便携式可穿戴设备可为智能手表、智能手环、头戴设备等。服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。其中为了方便理解,本申请中的服务器104可以看做CDN(Content Delivery Network,内容分发网络CDN是建立并覆盖在承载网之上,由遍布全球的边缘节点服务器群组成的分布式网络。CDN能分担源站压力,避免网络拥塞,确保在不同区域、不同场景下加速网站内容的分发,提高资源访问速度。常用于静态网页的部署。)集群,其包括CDN网关以及CDN节点,其中CDN网关用于重写回源路径,CDN节点中缓存有数据。源站106是用于存储回源数据的,其可以是指OSS Bucket,其中对象存储OSS(Object Storage Service)是一款海量、安全、低成本、高可靠的云存储服务。Bucket意为存储空间,是用户用于存储对象(Object)的容器,所有的对象都必须隶属于某个存储空间。存储空间具有各种配置属性,包括地域、访问权限、存储类型等。用户可以根据实际需求,创建不同类型的存储空间来存储不同的数据。Among them, the terminal 102 can be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices, and the Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, etc. . Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, and the like. The
回源指通过客户端请求访问资源时,如果CDN节点上未缓存该资源,CDN节点会回源站获取资源。Back-to-origin means that when a client requests to access a resource, if the resource is not cached on the CDN node, the CDN node will go back to the origin site to obtain the resource.
在一个实施例中,如图2所示,提供了一种数据回源方法,以该方法应用于图1中的服务器为例进行说明,包括以下步骤:In one embodiment, as shown in FIG. 2 , a data back-to-source method is provided. The method is applied to the server in FIG. 1 as an example for illustration, including the following steps:
S202:接收数据回源请求,数据回源请求携带有域名和回源路径。S202: Receive a data back-to-source request, where the data back-to-source request carries a domain name and a back-to-source path.
具体地,数据回源请求是用于查询原始数据的请求,该数据回源请求携带有域名和回源路径。该数据回源请求可以看做终端发送的CDN链接。Specifically, the data back-to-source request is a request for querying original data, and the data back-to-source request carries a domain name and a back-to-source path. The data back-to-source request can be regarded as the CDN link sent by the terminal.
其中域名是一串用点分隔的名字组成的源站的电子方位,其可以标识源站的位置。回源路径是在源站中数据的存储路径,例如文件访问的路径。Wherein the domain name is the electronic location of the source site composed of a string of names separated by dots, which can identify the location of the source site. The back-to-source path is the storage path of data in the origin server, such as the path for file access.
S204:根据域名对回源路径进行重写得到重写回源路径,重写回源路径中的域名与源站中一级目录对应,回源路径为一级目录下的资源路径。S204: Rewrite the origin-returning path according to the domain name to obtain the rewritten origin-returning path, the domain name in the rewritten origin-returning path corresponds to the first-level directory in the origin site, and the origin-returning path is a resource path under the first-level directory.
具体地,重写回源路径是根据域名对回源路径进行改造后得到的,例如将域名和回源路径按照重写规则进行组合得到重写回源路径,其中重写规则是基于源站中数据的存储的文件路径生成的,在本实施例中为了方便源站中的数据存储至对应的域名文件夹下,也就是说源站中包括多个一级目录,每个一级目录对应一个域名,例如每个一级目录均以对应的域名进行命令,每个域名对应的一级目录下存储该域名对应的数据,不同的数据存储至不同的文件夹下,这样多个域名下的资源互不相关,不会出现A域名下能访问到B域名资源的问题,且CDN访问链接不会受OSS一级目录的影响,使用无感知,此外因OSS Bucket只使用了一个,一级文件夹以域名划分,规则简单明了,后期管理维护成本低。后续通过域名加数据所在文件夹的路径即可以得到重写回源路径,因此重写规则即将文件夹的路径,即回源路径添加至对应的域名之后即可,也即将域名和回源路径进行拼接。该重写规则可以借助自定义边缘脚本来生成,即可像搭积木一样定制配置回源逻辑,边缘脚本(EdgeScript,简称ES)是一个快速实现CDN/DCDN定制配置的工具箱,当CDN/DCDN控制台上的标准配置无法满足业务需求时,可以尝试使用边缘脚本简单编程实现。Specifically, the rewritten back-to-source path is obtained by modifying the back-to-source path according to the domain name, for example, combining the domain name and the back-to-source path according to the rewriting rules to obtain the The file path for data storage is generated. In this embodiment, in order to facilitate the data storage in the source site to the corresponding domain name folder, that is to say, the source site includes multiple first-level directories, and each first-level directory corresponds to a Domain name, for example, each first-level directory uses the corresponding domain name to execute commands. The data corresponding to the domain name is stored in the first-level directory corresponding to each domain name, and different data are stored in different folders. In this way, resources under multiple domain names They are not related to each other, and there will be no problem that domain name A can access resources in domain name B, and the CDN access link will not be affected by the OSS first-level directory, and there is no perception of use. In addition, because the OSS Bucket only uses one, the first-level folder Divided by domain name, the rules are simple and clear, and the cost of later management and maintenance is low. Subsequently, the path of the folder where the data is located can be rewritten by adding the domain name to the path to the source. Therefore, the rewriting rule is to add the path of the folder, that is, the path to the source to the corresponding domain name, that is, the domain name and the path to the source. stitching. The rewriting rules can be generated with the help of custom edge scripts, which can be used to customize and configure back-to-source logic like building blocks. EdgeScript (ES for short) is a toolbox for quickly implementing customized CDN/DCDN configurations. When CDN/DCDN When the standard configuration on the console cannot meet business needs, you can try to use edge scripts for simple programming.
S206:根据重写回源路径查询源站得到对应的数据,并返回所查询到的数据。S206: Query the source site according to the rewritten back-to-source path to obtain corresponding data, and return the queried data.
源站是用于存储数据的存储空间,服务器根据重写回源路径查询源站对应的文件夹得到数据,并将数据返回至终端。The source site is a storage space for storing data. The server queries the corresponding folder of the source site according to the rewritten back-to-source path to obtain the data, and returns the data to the terminal.
其中服务器先根据重写回源路径中的域名查询一级目录,然后继续根据回源路径从一级目录下获取对应的文件夹得到对应的数据,并将所读取到的数据返回至终端。The server first queries the first-level directory according to the domain name in the rewritten back-to-source path, and then continues to obtain the corresponding data from the corresponding folder under the first-level directory according to the back-to-source path, and returns the read data to the terminal.
具体地,结合图3所示,图3为一个实施例中回源请求经边缘脚本改写回源路径后回源同一个OSS bucket的流程图。其中,终端(图中示为客户端)发送CDN链接请求,需要说明的是,本实施例中为了方便可以多个终端或者是一个终端发送多个链接请求,在此不做具体限定,例如存在链接请求1:http://www.exampledomain.com/examplefile1.html。链接请求2:http://www.exampledomain1.com/examplefile3.html等等,在此不做赘述。当请求到达服务器,也即CDN边缘节点时,服务器(图中示为CDN边缘节点)对链接请求进行回源路径的重写,例如,链接请求1进行重写,从回源路径examplefile1.html重写为重写回源路径/www.exampledomain.com/examplefile1.html。链接请求2进行重写,从回源路径examplefile3.html重写为重写回源路径/www.exampledomain1.com/examplefile3.html。后续根据重写回源路径去OSS Bucket中查询得到对应的数据,如图3中OSS Bucket的文件目录结构,其中一级目录为域名,二级以及以上目录形成了回源路径,这样可以方便查询。Specifically, as shown in FIG. 3 , FIG. 3 is a flow chart of returning to the same OSS bucket after the back-to-origin request is rewritten by the edge script to the back-to-origin path in one embodiment. Wherein, a terminal (shown as a client in the figure) sends a CDN link request. It should be noted that in this embodiment, for convenience, multiple terminals or one terminal can send multiple link requests, which is not specifically limited here. For example, there is Link Request 1: http://www.exampledomain.com/examplefile1.html . Link request 2: http://www.exampledomain1.com/examplefile3.html , etc., which will not be repeated here. When the request reaches the server, that is, the CDN edge node, the server (shown as the CDN edge node in the figure) rewrites the link request's back-to-source path. For example, link request 1 is rewritten from the back-to-source path examplefile1.html Write to rewrite back to the source path /www.exampledomain.com/examplefile1.html . Link request 2 is rewritten from the back-to-source path examplefile3.html to rewrite the back-to-source path /www.exampledomain1.com/examplefile3.html . Follow up by rewriting the back-to-source path to query the corresponding data in the OSS Bucket, as shown in the file directory structure of the OSS Bucket in Figure 3, in which the first-level directory is the domain name, and the second-level and above directories form the back-to-source path, which is convenient for query .
上述数据回源方法,在接收到数据回源请求后,根据所述域名对所述回源路径进行重写得到重写回源路径,由于各个域名共用一个源站,且与源站中一级目录对应,这样不同的域名不需要按约定使用一个一级目录,实现了文件的隔离,且回源路径为所述一级目录下的资源路径,这样不同的数据的域名一样,其回源路径也不相同,因此各个域名下的资源互不相关,不会出现A域名下能访问到B域名资源的问题,且由于仅适用了一个源站,以一级目录进行域名的划分,规则简单明了,也便于后期的管理和维护。In the above data back-to-source method, after receiving the data back-to-source request, the back-to-source path is rewritten according to the domain name to obtain the rewritten back-to-source path. Directory correspondence, so that different domain names do not need to use a first-level directory according to the agreement, which realizes the isolation of files, and the return-to-source path is the resource path under the first-level directory. In this way, the domain names of different data are the same, and the return-to-source path They are also different, so the resources under each domain name are not related to each other, and there will be no problem that A domain name can access B domain name resources, and because only one origin site is applicable, the domain name is divided by the first-level directory, and the rules are simple and clear , It is also convenient for later management and maintenance.
在其中一个实施例中,根据重写回源路径查询源站得到对应的数据之前,还包括:根据重写回源路径查询节点中是否缓存有对应的数据;当节点中缓存有对应的数据时,从节点获取到对应的数据,并返回;当节点中未缓存有对应的数据时,则继续根据重写回源路径查询源站得到对应的数据的步骤。In one of the embodiments, before querying the source site according to the rewritten back-to-source path to obtain the corresponding data, it also includes: querying whether there is corresponding data cached in the node according to the rewritten back-to-source path; when there is corresponding data cached in the node , get the corresponding data from the node, and return it; if there is no corresponding data cached in the node, continue to query the source station to obtain the corresponding data according to the rewritten back-to-source path.
其中节点是指CDN节点,其中CDN节点的缓存中存储有一些回源数据。The node refers to a CDN node, where some back-to-source data is stored in the cache of the CDN node.
具体地,结合图4所示,图4为另一个实施例中的数据回源方法的流程图,当终端请求到达CDN节点后,节点网关会根据预先编写的边缘脚本规则对请求进行处理,若处理后的请求命中了节点的缓存则将结果返回,若没有命中缓存,则继续回源OSS bucket。此处的边缘脚本是一段可在CDN节点运行的脚本代码,运行指的是运行脚本代码;边缘脚本内置了很多函数和方法来处理请求,所以称为工具箱,开发者基于这些函数方法来编写脚本程序代码从而达到定制的目标。Specifically, as shown in FIG. 4, FIG. 4 is a flow chart of a data back-to-source method in another embodiment. When a terminal request reaches a CDN node, the node gateway will process the request according to the pre-written edge script rules. If If the processed request hits the cache of the node, the result will be returned. If the request does not hit the cache, it will continue to return to the source OSS bucket. The edge script here is a piece of script code that can be run on the CDN node. Running refers to running the script code; the edge script has many built-in functions and methods to process requests, so it is called a toolbox. Developers write based on these functions and methods Script program code to achieve customized goals.
在其中一个实施例中,根据域名对回源路径进行重写得到重写回源路径,包括:改写回源路径得到带域名的初始回源路径;获取数据回源请求中的参数;根据初始回源路径和参数进行重写到重写回源路径。In one of the embodiments, rewriting the back-to-source path according to the domain name to obtain the rewritten back-to-source path includes: rewriting the back-to-source path to obtain an initial back-to-source path with a domain name; obtaining parameters in the data back-to-source request; The source path and parameters are rewritten to rewrite back to the source path.
具体地,结合图5所示,图5为一个实施例中的重写步骤的流程图,在该实施例中,对于回源路径的重写过程主要包括两步,第一步是构建带域名的初始回源路径,即构建带域名的会员uri,然后重写回源和缓存的uri保持参数不变,其中,第一步只是构造出需要的uri暂存为一个变量,实际还没进行重写,第二步才使用第一步的变量进行重写,保持参数不变:意思是一个链接请求后面可能会拼接参数比如https://bixin.cn/m-ypp?source=1&test=1,?及?后的字符串为参数,参数不固定,由请求发起者随意拼接。Specifically, as shown in FIG. 5 , FIG. 5 is a flow chart of the rewriting steps in an embodiment. In this embodiment, the rewriting process for the back-to-source path mainly includes two steps. The first step is to construct a The initial back-to-source path, that is, to build a member uri with a domain name, and then rewrite the back-to-source and cached uri to keep the parameters unchanged. Among them, the first step is to construct the required uri and temporarily store it as a variable, but it has not yet been rewritten. Write, the second step is to use the variables of the first step to rewrite, keeping the parameters unchanged: it means that a link request may be followed by splicing parameters such as https://bixin.cn/m-ypp? source=1&test=1,? and? The following string is a parameter, which is not fixed and can be spliced at will by the request initiator.
在其中一个实施例中,根据域名对回源路径进行重写得到重写回源路径之后,还包括:在请求响应头信息中新增重写回源路径;方法还包括:在调试时,查询并显示请求响应头信息中的重写回源路径。In one of the embodiments, after rewriting the back-to-source path according to the domain name to obtain the rewritten back-to-source path, it also includes: adding a rewritten back-to-source path in the request response header information; the method also includes: during debugging, query And display the rewritten back-to-origin path in the request response header information.
具体地,继续结合图5所示,其中response header(请求响应头信息)新增X-CDN-FILE-PATH,X为习惯命名规范,一般是自定义头信息的前缀,CDN-FILE-PATH为CDN文件路径,这个字段是方便开发者查看实际回源的路径是什么,方便调试补全信息。Specifically, continue to combine with Figure 5, where the response header (request response header information) adds X-CDN-FILE-PATH, X is a customary naming convention, generally the prefix of custom header information, and CDN-FILE-PATH is CDN file path, this field is convenient for developers to check the actual path back to the source, and it is convenient for debugging and completion information.
在其中一个实施例中,上述数据回源方法还包括:接收新增域名请求,新增域名请求携带有至少一个新增域名;配置新增域名为同一个源站;在源站中生成与新增域名对应的一级目录,并在一级目录下管理与新增域名对应的数据。In one of the embodiments, the above-mentioned data back-to-source method further includes: receiving a request for adding a new domain name, and the request for adding a domain name carries at least one new domain name; configuring the new domain name to be the same origin site; Add the first-level directory corresponding to the domain name, and manage the data corresponding to the newly added domain name under the first-level directory.
具体地,本实施例中主要是在新增域名时的配置的过程,其中CDN新增多个域名,此时配置多个域名的源站为同一个源站,即OSS Bucket,其中源站中的一级目录与域名对应,优选的源站中的一级目录的名称为对应的域名,也就是说新增域名时在OSS bucket新增相同域名的一级文件夹,在对应域名的文件夹里可管理文件,多个文件夹下的文件互不影响。Specifically, in this embodiment, it is mainly the configuration process when adding a new domain name, in which CDN adds multiple domain names, and at this time the source site for configuring multiple domain names is the same source site, that is, the OSS Bucket, where the source site The first-level directory corresponds to the domain name. The name of the first-level directory in the preferred source site is the corresponding domain name. That is to say, when adding a domain name, add a first-level folder of the same domain name in the OSS bucket, and add Files can be managed here, and files in multiple folders do not affect each other.
在其中一个实施例中,配置新增域名为同一个源站之后,还包括:配置新增域名的回源路径重写规则;根据域名对回源路径进行重写得到重写回源路径,包括:获取域名对应的回源路径重写规则;通过回源路径重写规则,根据域名对回源路径进行重写得到重写回源路径。In one of the embodiments, after configuring the newly added domain name as the same source site, it also includes: configuring the return-to-source path rewriting rules for the newly added domain name; rewriting the return-to-source path according to the domain name to obtain the rewritten return-to-source path, including : Obtain the origin-returning path rewriting rules corresponding to the domain name; through the rewriting rules of the origin-returning path, rewrite the origin-returning path according to the domain name to obtain the rewritten origin-returning path.
具体地,配置新增域名的回源路径重写规则即编写边缘脚本回源路径重定向核心代码;其中该回源路径重写规则主要实现以下功能:构建带域名的回源uri,将域名拼接在路径前,修改回源和缓存的uri,保持参数不变,以及为response header新增X-CDN-FILE-PATH,标识回源重定向的uri。Specifically, configuring the return-to-origin path rewriting rule for the newly added domain name means writing the core code of the edge script’s return-to-origin path redirection; the return-to-origin path rewriting rule mainly realizes the following functions: construct a return-to-origin uri with a domain name, and splicing the domain names Before the path, modify the back-to-origin and cache uri, keep the parameters unchanged, and add X-CDN-FILE-PATH to the response header to identify the uri for back-to-origin redirection.
上述实施例中,多个域名回源同一个OSS bucket。且引入CDN边缘脚本的使用,定制回源逻辑。边缘脚本将回源路径改写为带域名前缀的路径。OSS bucket里一级文件夹以域名命名,方便多域名文件的管理。In the above example, multiple domain names are returned to the same OSS bucket. And introduce the use of CDN edge scripts to customize the back-to-source logic. The edge script rewrites the return-to-origin path to a path with a domain name prefix. The first-level folders in the OSS bucket are named after domain names, which facilitates the management of multi-domain files.
应该理解的是,虽然如上的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the steps in the flow charts involved in the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the flow charts involved in the above embodiments may include multiple steps or stages, and these steps or stages are not necessarily executed at the same time, but may be executed at different times, The execution order of these steps or stages is not necessarily performed sequentially, but may be executed in turn or alternately with other steps or at least a part of steps or stages in other steps.
基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的数据回源方法的数据回源装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个数据回源装置实施例中的具体限定可以参见上文中对于数据回源方法的限定,在此不再赘述。Based on the same inventive concept, an embodiment of the present application further provides a data return-to-source device for implementing the above-mentioned data return-to-source method. The solution to the problem provided by the device is similar to the implementation described in the above method, so the specific limitations in one or more embodiments of the data return device provided below can be referred to above for the data return method limited and will not be repeated here.
在一个实施例中,如图6所示,提供了一种数据回源装置,包括:数据回源请求接收模块601、重写模块602和回源模块603,其中:In one embodiment, as shown in FIG. 6 , a data back-to-source device is provided, including: a data back-to-source
数据回源请求接收模块601,用于接收数据回源请求,数据回源请求携带有域名和回源路径;The data back-to-source
重写模块602,用于根据域名对回源路径进行重写得到重写回源路径,重写回源路径中的域名与源站中一级目录对应,回源路径为一级目录下的资源路径;The
回源模块603,应用于根据重写回源路径查询源站得到对应的数据,并返回所查询到的数据。The back-to-
在其中一个实施例中,上述数据回源装置还包括:In one of the embodiments, the above data returning device further includes:
查询模块,用于根据重写回源路径查询节点中是否缓存有对应的数据;当节点中缓存有对应的数据时,从节点获取到对应的数据,并返回;当节点中未缓存有对应的数据时,则继续根据重写回源路径查询源站得到对应的数据的步骤。The query module is used to query whether there is corresponding data cached in the node according to the rewritten back-to-source path; when the corresponding data is cached in the node, the corresponding data is obtained from the node and returned; data, continue to query the source site to obtain the corresponding data according to the rewritten back-to-source path.
在其中一个实施例中,上述重写模块602包括:In one of the embodiments, the above-mentioned
改写单元,用于改写回源路径得到带域名的初始回源路径;The rewriting unit is used to rewrite the back-to-source path to obtain the initial back-to-source path with a domain name;
参数获取单元,用于获取数据回源请求中的参数;A parameter acquisition unit, configured to acquire parameters in the data back-to-source request;
第一重写单元,用于根据初始回源路径和参数进行重写到重写回源路径。The first rewriting unit is configured to rewrite to the rewritten back-to-source path according to the initial back-to-source path and parameters.
在其中一个实施例中,上述数据回源装置还包括:In one of the embodiments, the above data returning device further includes:
改写模块,用于在请求响应头信息中新增重写回源路径;The rewriting module is used to add a rewriting back-to-source path in the request response header information;
调试模块,用于在调试时,查询并显示请求响应头信息中的重写回源路径。The debugging module is used to query and display the rewritten back-to-source path in the request response header information during debugging.
在其中一个实施例中,上述数据回源装置还包括:In one of the embodiments, the above data returning device further includes:
域名新增模块,用于接收新增域名请求,新增域名请求携带有至少一个新增域名;A domain name adding module, configured to receive a request for adding a domain name, where the request for adding a domain name carries at least one new domain name;
源站配置模块,用于配置新增域名为同一个源站;The source site configuration module is used to configure the newly added domain name as the same source site;
源站处理模块,用于在源站中生成与新增域名对应的一级目录,并在一级目录下管理与新增域名对应的数据。The origin station processing module is used to generate a first-level directory corresponding to the newly added domain name in the origin station, and manage data corresponding to the newly added domain name under the first-level directory.
在其中一个实施例中,上述数据回源装置还包括:In one of the embodiments, the above data returning device further includes:
重写规则配置模块,用于配置新增域名的回源路径重写规则;The rewrite rule configuration module is used to configure the return-to-source path rewrite rules for newly added domain names;
上述重写模块602包括:The above-mentioned
重写规则获取单元,用于获取域名对应的回源路径重写规则;A rewrite rule acquisition unit, configured to obtain the rewrite rule of the back-to-source path corresponding to the domain name;
第二重写单元,用于通过回源路径重写规则,根据域名对回源路径进行重写得到重写回源路径。The second rewriting unit is configured to rewrite the source-returning path according to the domain name to obtain the rewritten source-returning path through the rewriting rule of the source-returning path.
上述数据回源装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。Each module in the above-mentioned data return-to-source device can be fully or partially realized by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can invoke and execute the corresponding operations of the above-mentioned modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图7所示。该计算机设备包括处理器、存储器、输入/输出接口(Input/Output,简称I/O)和通信接口。其中,处理器、存储器和输入/输出接口通过系统总线连接,通信接口通过输入/输出接口连接到系统总线。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储回源数据。该计算机设备的输入/输出接口用于处理器与外部设备之间交换信息。该计算机设备的通信接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种数据回源方法。In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure may be as shown in FIG. 7 . The computer device includes a processor, a memory, an input/output interface (Input/Output, I/O for short), and a communication interface. Wherein, the processor, the memory and the input/output interface are connected through the system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein, the processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs and databases. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The computer device's database is used to store back-to-source data. The input/output interface of the computer device is used for exchanging information between the processor and external devices. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for returning data to the source is realized.
本领域技术人员可以理解,图7中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in Figure 7 is only a block diagram of a part of the structure related to the solution of this application, and does not constitute a limitation to the computer equipment on which the solution of this application is applied. The specific computer equipment can be More or fewer components than shown in the figures may be included, or some components may be combined, or have a different arrangement of components.
在一个实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现以下步骤:接收数据回源请求,数据回源请求携带有域名和回源路径;根据域名对回源路径进行重写得到重写回源路径,重写回源路径中的域名与源站中一级目录对应,回源路径为一级目录下的资源路径;根据重写回源路径查询源站得到对应的数据,并返回所查询到的数据。In one embodiment, a computer device is provided, including a memory and a processor, a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: receiving a data back-to-source request, where the data back-to-source request carries a domain name and the return-to-source path; the rewritten return-to-source path is obtained by rewriting the return-to-source path according to the domain name, the domain name in the rewritten return-to-source path corresponds to the first-level directory in the source station, and the return-to-source path is the resource path under the first-level directory; Query the source site according to the rewritten back-to-source path to obtain the corresponding data, and return the queried data.
在一个实施例中,处理器执行计算机程序时所实现的根据重写回源路径查询源站得到对应的数据之前,还包括:根据重写回源路径查询节点中是否缓存有对应的数据;当节点中缓存有对应的数据时,从节点获取到对应的数据,并返回;当节点中未缓存有对应的数据时,则继续根据重写回源路径查询源站得到对应的数据的步骤。In one embodiment, when the processor executes the computer program, before querying the source site according to the rewritten back-to-source path to obtain the corresponding data, it also includes: querying whether there is corresponding data cached in the node according to the rewritten back-to-source path; when When the corresponding data is cached in the node, the corresponding data is obtained from the node and returned; when the corresponding data is not cached in the node, the step of querying the source station to obtain the corresponding data according to the rewritten back-to-source path is continued.
在一个实施例中,处理器执行计算机程序时所实现的根据域名对回源路径进行重写得到重写回源路径,包括:改写回源路径得到带域名的初始回源路径;获取数据回源请求中的参数;根据初始回源路径和参数进行重写到重写回源路径。In one embodiment, when the processor executes the computer program, rewriting the back-to-source path according to the domain name to obtain the rewritten back-to-source path includes: rewriting the back-to-source path to obtain an initial back-to-source path with a domain name; obtaining data back-to-source Parameters in the request; rewrite to the rewritten back-to-source path according to the initial back-to-source path and parameters.
在一个实施例中,处理器执行计算机程序时所实现的根据域名对回源路径进行重写得到重写回源路径之后,还包括:在请求响应头信息中新增重写回源路径;处理器执行计算机程序时还实现以下步骤:在调试时,查询并显示请求响应头信息中的重写回源路径。In one embodiment, after the processor executes the computer program to rewrite the back-to-source path according to the domain name to obtain the rewritten back-to-source path, it further includes: adding a rewritten back-to-source path in the request response header information; processing The following steps are also implemented when the server executes the computer program: when debugging, query and display the rewritten back-to-source path in the request response header information.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:接收新增域名请求,新增域名请求携带有至少一个新增域名;配置新增域名为同一个源站;在源站中生成与新增域名对应的一级目录,并在一级目录下管理与新增域名对应的数据。In one embodiment, when the processor executes the computer program, the following steps are also implemented: receiving a request for adding a domain name, and the request for adding a domain name carries at least one new domain name; configuring the new domain name to be the same origin site; generating The first-level directory corresponding to the new domain name, and manage the data corresponding to the new domain name under the first-level directory.
在一个实施例中,处理器执行计算机程序时所实现的配置新增域名为同一个源站之后,还包括:配置新增域名的回源路径重写规则;处理器执行计算机程序时根据域名对回源路径进行重写得到重写回源路径,包括:获取域名对应的回源路径重写规则;通过回源路径重写规则,根据域名对回源路径进行重写得到重写回源路径。In one embodiment, after the processor executes the computer program, after configuring the newly added domain name to be the same source site, it further includes: configuring the return-to-origin path rewriting rules for the newly added domain name; when the processor executes the computer program, according to the domain name pair Rewriting the back-to-source path to obtain a rewritten back-to-source path includes: obtaining the back-to-source path rewriting rules corresponding to the domain name; rewriting the back-to-source path according to the domain name through the back-to-source path rewriting rules to obtain the rewritten back-to-source path.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:接收数据回源请求,数据回源请求携带有域名和回源路径;根据域名对回源路径进行重写得到重写回源路径,重写回源路径中的域名与源站中一级目录对应,回源路径为一级目录下的资源路径;根据重写回源路径查询源站得到对应的数据,并返回所查询到的数据。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: receiving a data back-to-source request, where the data back-to-source request carries a domain name and a back-to-source path; the rewritten path to the source is obtained by rewriting the path to the source according to the domain name. The back-to-source path queries the source site to obtain the corresponding data, and returns the queried data.
在一个实施例中,计算机程序被处理器执行时所实现的根据重写回源路径查询源站得到对应的数据之前,还包括:根据重写回源路径查询节点中是否缓存有对应的数据;当节点中缓存有对应的数据时,从节点获取到对应的数据,并返回;当节点中未缓存有对应的数据时,则继续根据重写回源路径查询源站得到对应的数据的步骤。In one embodiment, when the computer program is executed by the processor, before querying the source site according to the rewritten back-to-source path to obtain the corresponding data, it further includes: querying whether there is corresponding data cached in the node according to the rewritten back-to-source path; When the corresponding data is cached in the node, the corresponding data is obtained from the node and returned; when the corresponding data is not cached in the node, continue the step of querying the source site to obtain the corresponding data according to the rewritten back-to-source path.
在一个实施例中,计算机程序被处理器执行时所实现的根据域名对回源路径进行重写得到重写回源路径,包括:改写回源路径得到带域名的初始回源路径;获取数据回源请求中的参数;根据初始回源路径和参数进行重写到重写回源路径。In one embodiment, when the computer program is executed by the processor, rewriting the back-to-source path according to the domain name to obtain the rewritten back-to-source path includes: rewriting the back-to-source path to obtain an initial back-to-source path with a domain name; Parameters in the source request; rewrite to the rewritten back-to-source path according to the initial back-to-source path and parameters.
在一个实施例中,计算机程序被处理器执行时所实现的根据域名对回源路径进行重写得到重写回源路径之后,还包括:在请求响应头信息中新增重写回源路径;计算机程序被处理器执行时还实现以下步骤:在调试时,查询并显示请求响应头信息中的重写回源路径。In one embodiment, after the computer program is executed by the processor to rewrite the back-to-source path according to the domain name to obtain the rewritten back-to-source path, it further includes: adding the rewritten back-to-source path in the request response header information; When the computer program is executed by the processor, the following steps are also implemented: during debugging, query and display the rewritten back-to-source path in the request response header information.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:接收新增域名请求,新增域名请求携带有至少一个新增域名;配置新增域名为同一个源站;在源站中生成与新增域名对应的一级目录,并在一级目录下管理与新增域名对应的数据。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: receiving a new domain name request, the new domain name request carries at least one new domain name; configuring the new domain name to be the same source site; Generate a first-level directory corresponding to the newly added domain name, and manage data corresponding to the newly added domain name under the first-level directory.
在一个实施例中,计算机程序被处理器执行时所实现的配置新增域名为同一个源站之后,还包括:配置新增域名的回源路径重写规则;计算机程序被处理器执行时根据域名对回源路径进行重写得到重写回源路径,包括:获取域名对应的回源路径重写规则;通过回源路径重写规则,根据域名对回源路径进行重写得到重写回源路径。In one embodiment, after the computer program is executed by the processor, after configuring the newly added domain name to be the same source site, it further includes: configuring the return-to-origin path rewriting rules for the newly added domain name; when the computer program is executed by the processor, according to The domain name rewrites the back-to-source path to obtain the rewritten back-to-source path, including: obtaining the back-to-source path rewriting rules corresponding to the domain name; through the back-to-source path rewriting rules, rewriting the back-to-source path according to the domain name to obtain the rewritten back-to-source path path.
在一个实施例中,提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现以下步骤:接收数据回源请求,数据回源请求携带有域名和回源路径;根据域名对回源路径进行重写得到重写回源路径,重写回源路径中的域名与源站中一级目录对应,回源路径为一级目录下的资源路径;根据重写回源路径查询源站得到对应的数据,并返回所查询到的数据。In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the following steps are implemented: receiving a data back-to-source request, where the data back-to-source request carries a domain name and a back-to-source path; according to the domain name Rewrite the back-to-source path to obtain the rewritten back-to-source path, the domain name in the rewritten back-to-source path corresponds to the first-level directory in the source site, and the back-to-source path is the resource path under the first-level directory; query based on the rewritten back-to-source path The source station obtains the corresponding data and returns the queried data.
在一个实施例中,计算机程序被处理器执行时所实现的根据重写回源路径查询源站得到对应的数据之前,还包括:根据重写回源路径查询节点中是否缓存有对应的数据;当节点中缓存有对应的数据时,从节点获取到对应的数据,并返回;当节点中未缓存有对应的数据时,则继续根据重写回源路径查询源站得到对应的数据的步骤。In one embodiment, when the computer program is executed by the processor, before querying the source site according to the rewritten back-to-source path to obtain the corresponding data, it further includes: querying whether there is corresponding data cached in the node according to the rewritten back-to-source path; When the corresponding data is cached in the node, the corresponding data is obtained from the node and returned; when the corresponding data is not cached in the node, continue the step of querying the source site to obtain the corresponding data according to the rewritten back-to-source path.
在一个实施例中,计算机程序被处理器执行时所实现的根据域名对回源路径进行重写得到重写回源路径,包括:改写回源路径得到带域名的初始回源路径;获取数据回源请求中的参数;根据初始回源路径和参数进行重写到重写回源路径。In one embodiment, when the computer program is executed by the processor, rewriting the back-to-source path according to the domain name to obtain the rewritten back-to-source path includes: rewriting the back-to-source path to obtain an initial back-to-source path with a domain name; Parameters in the source request; rewrite to the rewritten back-to-source path according to the initial back-to-source path and parameters.
在一个实施例中,计算机程序被处理器执行时所实现的根据域名对回源路径进行重写得到重写回源路径之后,还包括:在请求响应头信息中新增重写回源路径;计算机程序被处理器执行时还实现以下步骤:在调试时,查询并显示请求响应头信息中的重写回源路径。In one embodiment, after the computer program is executed by the processor to rewrite the back-to-source path according to the domain name to obtain the rewritten back-to-source path, it further includes: adding the rewritten back-to-source path in the request response header information; When the computer program is executed by the processor, the following steps are also implemented: during debugging, query and display the rewritten back-to-source path in the request response header information.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:接收新增域名请求,新增域名请求携带有至少一个新增域名;配置新增域名为同一个源站;在源站中生成与新增域名对应的一级目录,并在一级目录下管理与新增域名对应的数据。In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: receiving a new domain name request, the new domain name request carries at least one new domain name; configuring the new domain name to be the same source site; Generate a first-level directory corresponding to the newly added domain name, and manage data corresponding to the newly added domain name under the first-level directory.
在一个实施例中,计算机程序被处理器执行时所实现的配置新增域名为同一个源站之后,还包括:配置新增域名的回源路径重写规则;计算机程序被处理器执行时根据域名对回源路径进行重写得到重写回源路径,包括:获取域名对应的回源路径重写规则;通过回源路径重写规则,根据域名对回源路径进行重写得到重写回源路径。In one embodiment, after the computer program is executed by the processor, after configuring the newly added domain name to be the same source site, it further includes: configuring the return-to-origin path rewriting rules for the newly added domain name; when the computer program is executed by the processor, according to The domain name rewrites the back-to-source path to obtain the rewritten back-to-source path, including: obtaining the back-to-source path rewriting rules corresponding to the domain name; through the back-to-source path rewriting rules, rewriting the back-to-source path according to the domain name to obtain the rewritten back-to-source path path.
需要说明的是,本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据,且相关数据的收集、使用和处理需要遵守相关国家和地区的相关法律法规和标准。It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all It is information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-OnlyMemory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic RandomAccess Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above-mentioned embodiments can be completed by instructing related hardware through computer programs, and the computer programs can be stored in a non-volatile computer-readable memory In the medium, when the computer program is executed, it may include the processes of the embodiments of the above-mentioned methods. Wherein, any reference to storage, database or other media used in the various embodiments provided in the present application may include at least one of non-volatile and volatile storage. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive variable memory (ReRAM), magnetic variable memory (Magnetoresistive Random Access Memory, MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (Phase Change Memory, PCM), graphene memory, etc. The volatile memory may include random access memory (Random Access Memory, RAM) or external cache memory. As an illustration and not a limitation, RAM can be in various forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (Dynamic Random Access Memory, DRAM). The databases involved in the various embodiments provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a blockchain-based distributed database, etc., but is not limited thereto. The processors involved in the various embodiments provided by this application can be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, data processing logic devices based on quantum computing, etc., and are not limited to this.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered to be within the range described in this specification.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation modes of the present application, and the description thereof is relatively specific and detailed, but should not be construed as limiting the patent scope of the present application. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be determined by the appended claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310012413.0A CN116208676A (en) | 2023-01-05 | 2023-01-05 | Data back-source method, device, computer equipment, storage medium and program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310012413.0A CN116208676A (en) | 2023-01-05 | 2023-01-05 | Data back-source method, device, computer equipment, storage medium and program product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116208676A true CN116208676A (en) | 2023-06-02 |
Family
ID=86506980
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310012413.0A Pending CN116208676A (en) | 2023-01-05 | 2023-01-05 | Data back-source method, device, computer equipment, storage medium and program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116208676A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117061615A (en) * | 2023-10-09 | 2023-11-14 | 杭州优云科技有限公司 | Cache path acquisition method, device, computer equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018014837A1 (en) * | 2016-07-20 | 2018-01-25 | 腾讯科技(深圳)有限公司 | Content distribution network processing method, content distribution network, device, and storage medium |
CN109660578A (en) * | 2017-10-11 | 2019-04-19 | 阿里巴巴集团控股有限公司 | CDN's returns source processing method and processing device, system |
CN110659154A (en) * | 2018-06-28 | 2020-01-07 | 北京京东尚科信息技术有限公司 | Data processing method and device |
CN112422702A (en) * | 2020-08-10 | 2021-02-26 | 上海哔哩哔哩科技有限公司 | CDN back-to-source method, system and computer equipment |
-
2023
- 2023-01-05 CN CN202310012413.0A patent/CN116208676A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018014837A1 (en) * | 2016-07-20 | 2018-01-25 | 腾讯科技(深圳)有限公司 | Content distribution network processing method, content distribution network, device, and storage medium |
CN109660578A (en) * | 2017-10-11 | 2019-04-19 | 阿里巴巴集团控股有限公司 | CDN's returns source processing method and processing device, system |
CN110659154A (en) * | 2018-06-28 | 2020-01-07 | 北京京东尚科信息技术有限公司 | Data processing method and device |
CN112422702A (en) * | 2020-08-10 | 2021-02-26 | 上海哔哩哔哩科技有限公司 | CDN back-to-source method, system and computer equipment |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117061615A (en) * | 2023-10-09 | 2023-11-14 | 杭州优云科技有限公司 | Cache path acquisition method, device, computer equipment and storage medium |
CN117061615B (en) * | 2023-10-09 | 2024-01-16 | 杭州优云科技有限公司 | Cache path acquisition method, device, computer equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108279932B (en) | Method and device for dynamically configuring user interface of mobile terminal | |
CN107534671B (en) | Aggregation and Federation of Distributed Service Entities and Associations | |
US7739691B2 (en) | Framework for declarative expression of data processing | |
US11347808B1 (en) | Dynamically-adaptive bloom-filter | |
CN112256772A (en) | Data service method, device and readable storage medium | |
US10387387B2 (en) | Enabling multi-tenant access to respective isolated data sets organized using different application schemas | |
CN112615759B (en) | Full link voltage measurement assembly, full link voltage measurement method and device | |
CN103970758A (en) | Database accessing system and method | |
US8954488B2 (en) | Extensibility for web based diagram visualization | |
CN110046170A (en) | Sentence based on multifile management executes method, apparatus, equipment and medium | |
US20140280368A1 (en) | View variants in database schema mapping | |
CN112347794B (en) | Data translation method, device, equipment and computer storage medium | |
CN105302556A (en) | Calculation realization method and system and server apparatus | |
CN116208676A (en) | Data back-source method, device, computer equipment, storage medium and program product | |
US20160314155A1 (en) | Data integration pipeline | |
CN111881220B (en) | Data operation method and device under list storage, electronic equipment and storage medium | |
US20160188629A1 (en) | Virtual attribute federation system | |
CN116233254A (en) | Business cut-off method, device, computer equipment and storage medium | |
CN115130002A (en) | Recommendation request processing method and device, computer equipment and storage medium | |
CN114489854A (en) | Modularized software development method, system, device and storage medium | |
US11301498B2 (en) | Multi-cloud object store access | |
CN114817285A (en) | Data updating method, device, storage medium and device | |
CN117056028B (en) | Robot simulation platform construction method, device, computer equipment and storage medium | |
CN109361767A (en) | A server for optimizing client data display errors, a client processing method and server, and a client capable of data display | |
US20160078008A1 (en) | Integrating user interface experiences from multiple applications |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |