Data return-to-source method, apparatus, computer device, storage medium, and program product
By rewriting the return path during the CDN domain name return process to correspond to the first-level directory of the source site, the resource isolation problem when the CDN domain name returns to the same OSS bucket is solved, and effective isolation and simplified management of resources are achieved.
Patent Information
- Application Number
- CN202310012413.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-05
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2043-01-05
AI Technical Summary
When the CDN domain name returns to the same OSS bucket, the resources are not completely isolated, resulting in difficulty in managing fragmentation and post-maintenance.
By receiving data back to source requests, rewrite the return source path according to the domain name, generate a rewrite back to source path, so that it corresponds to the first-level directory in the source station, and query the source station to obtain data, realizing resource isolation.
It realizes that the resources under different domain names are not correlated, simplifies management and maintenance processes, and reduces the cost of later maintenance.
Smart Images

Figure CN116208676B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing technology, and particularly to a data source return method, apparatus, computer device, storage medium, and computer program product. Background Art
[0002] A CDN (Content Delivery Network) is a distributed network established and covering the bearer network, consisting of a group of edge node servers spread across the globe. The CDN can share the pressure on the origin server, avoid network congestion, ensure the acceleration of website content distribution in different regions and scenarios, and improve the resource access speed. It is commonly used for the deployment of static web pages. Returning a CDN domain name to an OSS bucket (OSS: Object Storage Service is a massive, secure, low-cost, and highly reliable cloud storage service. Bucket: It means a storage space, which is a container for users to store objects (Object). All objects must belong to a certain storage space. The storage space has various configuration attributes, including region, access permission, storage type, etc. Users can create different types of storage spaces according to actual needs to store different data.) is one of the commonly used management methods for traditional static web page deployment. This method has advantages such as fast access speed and convenient web page management and update. However, as the business scale expands, the number of CDN domain names increases, and the number of OSS buckets will also increase accordingly, resulting in fragmented management and high later maintenance costs.
[0003] In traditional technologies, there is also a management method where multiple CDN domain names return to the same OSS bucket, and each domain name uses a first-level folder of an OSS bucket as agreed. However, in this method, the resources of multiple domain names are not completely isolated. For example, the resource path under domain name A plus domain name B can access the resources of domain name B. Therefore, complete resource isolation is not achieved, and later maintenance is difficult. Summary of the Invention
[0004] Based on this, it is necessary to provide a data source return method, apparatus, computer device, computer-readable storage medium, and computer program product that can isolate resources and have simple subsequent maintenance for the above technical problems.
[0005] In a first aspect, this application provides a data source return method, and the method includes:
[0006] Receiving a data source return request, where the data source return request carries a domain name and a source return path;
[0007] Rewrite the origin path according to the domain name to obtain a rewritten origin path, where the domain name in the rewritten origin path corresponds to the first-level directory in the origin server, and the origin path is the resource path under the first-level directory;
[0008] Query the origin server according to the rewritten origin path to obtain corresponding data, and return the queried data.
[0009] In one embodiment, before querying the origin server according to the rewritten origin path to obtain corresponding data, it further includes:
[0010] Query whether the corresponding data is cached in the node according to the rewritten origin path;
[0011] When the corresponding data is cached in the node, obtain the corresponding data from the node and return it;
[0012] When the corresponding data is not cached in the node, continue with the step of querying the origin server according to the rewritten origin path to obtain corresponding data.
[0013] In one embodiment, the rewriting the origin path according to the domain name to obtain a rewritten origin path includes:
[0014] Rewrite the origin path to obtain an initial origin path with a domain name;
[0015] Obtain the parameters in the data origin request;
[0016] Rewrite to the rewritten origin path according to the initial origin path and the parameters.
[0017] In one embodiment, after rewriting the origin path according to the domain name to obtain a rewritten origin path, it further includes:
[0018] Add the rewritten origin path to the request response header information;
[0019] The method further includes:
[0020] During debugging, query and display the rewritten origin path in the request response header information.
[0021] In one embodiment, the method further includes:
[0022] Receive a new domain name request, where the new domain name request carries at least one new domain name;
[0023] Configure the new domain names to the same origin server;
[0024] Generate a first-level directory corresponding to the newly added domain name in the source station, and manage the data corresponding to the newly added domain name under the first-level directory.
[0025] In one embodiment, after configuring the newly added domain name to be the same source station, it further includes:
[0026] Configure the origin return path rewriting rule for the newly added domain name;
[0027] The step of rewriting the origin return path according to the domain name to obtain the rewritten origin return path includes:
[0028] Obtain the origin return path rewriting rule corresponding to the domain name;
[0029] Through the origin return path rewriting rule, rewrite the origin return path according to the domain name to obtain the rewritten origin return path.
[0030] In a second aspect, the present application further provides a data origin return device, and the device includes:
[0031] A data origin return request receiving module, configured to receive a data origin return request, where the data origin return request carries a domain name and an origin return path;
[0032] A rewriting module, configured to rewrite the origin return path according to the domain name to obtain a rewritten origin return path, where the domain name in the rewritten origin return path corresponds to a first-level directory in the source station, and the origin return path is a resource path under the first-level directory;
[0033] An origin return module, configured to query the source station according to the rewritten origin return path to obtain corresponding data, and return the queried data.
[0034] In a third aspect, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, it implements the steps of the method in any one of the above embodiments.
[0035] 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, it implements the steps of the method in any one of the above embodiments.
[0036] 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, it implements the steps of the method in any one of the above embodiments.
[0037] The above data fetching method, device, computer equipment, storage medium and computer program product, after receiving a data fetching request, rewrite the fetching path according to the domain name to obtain a rewritten fetching path. Since each domain name shares a single origin server and corresponds to the first-level directory in the origin server, different domain names do not need to use a first-level directory as agreed, achieving file isolation. And the fetching path is the resource path under the first-level directory. Thus, for different data with the same domain name, their fetching paths are different. Therefore, the resources under each domain name are not related to each other, and there will be no problem that resources of domain name B can be accessed under domain name A. Also, since only one origin server is used and domain names are divided by the first-level directory, the rule is simple and clear, which is also convenient for later management and maintenance. Description of the Drawings
[0038] Figure 1 It is an application environment diagram of the data fetching method in an embodiment;
[0039] Figure 2 It is a flowchart of the data fetching method in an embodiment;
[0040] Figure 3 It is a flowchart of the same OSS bucket being fetched after the fetching request is rewritten by the edge script for the fetching path in an embodiment;
[0041] Figure 4 It is a flowchart of the data fetching method in another embodiment;
[0042] Figure 5 It is a flowchart of the rewriting step in an embodiment;
[0043] Figure 6 It is a structural block diagram of the data fetching device in an embodiment;
[0044] Figure 7 It is an internal structure diagram of the computer equipment in an embodiment. Detailed Embodiments
[0045] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0046] The data fetching method provided by the embodiments of the present application can be applied to an application environment as Figure 1 shown. Among them, the terminal 102 communicates with the server 104 through the network, and the server 104 communicates with the origin server 106.
[0047] Among them, the terminal 102 generates a data origin return request based on the domain name and the origin return path, and sends the data origin return request to the server 104. The server 104 rewrites the origin return path according to the domain name to obtain a rewritten origin return path. The domain name in the rewritten origin return path corresponds to the first-level directory in the origin site. The origin return path is the resource path under the first-level directory, and queries the origin site 106 according to the rewritten origin return path to obtain the corresponding data, and returns the queried data to the terminal 102.
[0048] In this way, after receiving the data origin return request, the server 104 rewrites the origin return path according to the domain name to obtain a rewritten origin return path. Since each domain name shares an origin site and corresponds to the first-level directory in the origin site, different domain names do not need to use a first-level directory by agreement, realizing file isolation, and the origin return path is the resource path under the first-level directory. In this way, different data have the same domain name, but their origin return paths are different. Therefore, the resources under each domain name are not related to each other, and there will be no problem that the resources of domain name B can be accessed under domain name A. And because only one origin site is used and the domain names are divided by the first-level directory, the rules are simple and clear, which is also convenient for later management and maintenance.
[0049] Among them, the terminal 102 can be but is not limited to various personal computers, laptop computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented by an independent server or a server cluster composed of multiple servers. For the sake of easy understanding, the server 104 in this application can be regarded as a CDN (Content Delivery Network. The content delivery network CDN is a distributed network established and covering the bearer network, consisting of a group of edge node servers spread all over the world. CDN can share the pressure of the origin site, avoid network congestion, ensure the acceleration of website content distribution in different regions and different scenarios, and improve the resource access speed. It is commonly used for the deployment of static web pages.) cluster, which includes a CDN gateway and CDN nodes. The CDN gateway is used to rewrite the origin return path, and the data is cached in the CDN nodes. The origin site 106 is used to store the origin return data, which can refer to an OSS Bucket. Among them, the object storage OSS (Object Storage Service) is a massive, secure, low-cost, and 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. The storage space has various configuration attributes, including region, access permission, storage type, etc. Users can create different types of storage spaces according to actual needs to store different data.
[0050] Back-to-origin means that when a client requests access to 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.
[0051] In one embodiment, Figure 2 As shown, a data return method is provided, which is applied to Figure 1 The following steps are used as an example to illustrate the server in the example:
[0052] S202: Receive a data tracing request, which carries a domain name and a tracing path.
[0053] Specifically, a data back-to-source request is a request for querying the original data. 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 a CDN link sent by the terminal.
[0054] A domain name is a dot-separated string of names that identifies the origin server's electronic address. A back-to-source path is the path where data is stored on the origin server, such as the path used to access a file.
[0055] S204: rewrite the back-to-source path according to the domain name to obtain a rewritten back-to-source path, where the domain name in the rewritten back-to-source path corresponds to a first-level directory in the origin site, and the back-to-source path is a resource path under the first-level directory.
[0056] Specifically, the rewritten origin path is obtained by transforming the origin path according to the domain name. For example, the domain name and the origin path are combined according to the rewriting rule to obtain the rewritten origin path, where the rewriting rule is generated based on the file path where the data is stored in the origin server. In this embodiment, for the convenience of storing the data in the origin server into the corresponding domain name folder, that is to say, the origin server includes multiple first-level directories, and each first-level directory corresponds to a domain name. For example, each first-level directory is named after the corresponding domain name, and the data corresponding to the domain name is stored under the first-level directory corresponding to each domain name. Different data is stored in different folders, so that the resources under multiple domain names are not related to each other, and the problem that the resources of domain name B can be accessed under domain name A will not occur. Moreover, the CDN access link will not be affected by the OSS first-level directory, and the use is seamless. In addition, since only one OSS Bucket is used and the first-level folders are divided by domain names, the rule is simple and clear, and the later management and maintenance cost is low. Subsequently, the rewritten origin path can be obtained by adding the domain name and the path of the folder where the data is located. Therefore, the rewriting rule is to add the path of the folder, that is, the origin path, after the corresponding domain name, that is, to splice the domain name and the origin path. This rewriting rule can be generated by means of a custom edge script, that is, the origin logic can be customized and configured like building blocks. The edge script (EdgeScript, abbreviated as ES) is a toolbox for quickly implementing CDN / DCDN custom configuration. When the standard configuration on the CDN / DCDN console cannot meet the business requirements, you can try to use the edge script for simple programming to achieve it.
[0057] S206: Query the origin server according to the rewritten origin path to obtain the corresponding data, and return the queried data.
[0058] The origin server is a storage space for storing data. The server queries the corresponding folder of the origin server according to the rewritten origin path to obtain the data, and returns the data to the terminal.
[0059] Among them, the server first queries the first-level directory according to the domain name in the rewritten origin path, and then continues to obtain the corresponding folder from the first-level directory according to the origin path to obtain the corresponding data, and returns the read data to the terminal.
[0060] Specifically, combined with Figure 3 shown, Figure 3 is a flowchart of the origin request returning to the same OSS bucket after the origin path is rewritten by the edge script in an embodiment. Among them, the terminal (shown as the client in the figure) sends a CDN link request. It should be noted that in this embodiment, for the convenience of multiple terminals or a single terminal to send multiple link requests, no specific limitation is made here. For example, there is link request 1: http: / / www.exampledomain.com / examplefile1.html。Link request 2: http: / / www.exampledomain1.com / examplefile3.html And so on, which will not be elaborated 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 return source path of the link request. For example, link request 1 is rewritten from the return source path examplefile1.html Rewritten to the rewritten return source path / www.exampledomain.com / examplefile1.html 。Link request 2 is rewritten from the return source path examplefile3.html Rewritten to the rewritten return source path / www.exampledomain1.com / examplefile3.html 。Subsequently, according to the rewritten return source path, the corresponding data is queried from the OSS Bucket. For example, Figure 3 The file directory structure of the OSS Bucket in, where the first-level directory is the domain name, and the second-level and above directories form the return source path, which is convenient for querying.
[0061] In the above data return source method, after receiving the data return source request, the return source path is rewritten according to the domain name to obtain the rewritten return source path. Since each domain name shares a source station and corresponds to the first-level directory in the source station, different domain names do not need to use a first-level directory by agreement, realizing file isolation, and the return source path is the resource path under the first-level directory. In this way, for domain names with the same data, their return source paths are also different. Therefore, the resources under each domain name are not related to each other, and there will be no problem that the resources of domain name B can be accessed under domain name A. And because only one source station is used and the domain names are divided by the first-level directory, the rules are simple and clear, which is also convenient for later management and maintenance.
[0062] In one embodiment, before querying the source station according to the rewritten return source path to obtain the corresponding data, it further includes: querying whether the corresponding data is cached in the node according to the rewritten return source path; when the corresponding data is cached in the node, obtaining the corresponding data from the node and returning it; when the corresponding data is not cached in the node, then continuing with the step of querying the source station according to the rewritten return source path to obtain the corresponding data.
[0063] Where the node refers to the CDN node, and some return source data is stored in the cache of the CDN node.
[0064] Specifically, as shown in combination with Figure 4 Shown, Figure 4This is a flowchart of a data back-to-source method in another embodiment. When a terminal request reaches a CDN node, the node gateway processes the request according to pre-programmed edge script rules. If the processed request hits the node's cache, the result is returned. If not, the back-to-source OSS bucket continues. The edge script here is a piece of script code that can be executed on the CDN node. "Run" refers to running the script code. Edge scripts have many built-in functions and methods for processing requests, hence the name "toolbox." Developers use these functions and methods to write script code to achieve customized goals.
[0065] In one embodiment, rewriting the back-to-source path according to the domain name to obtain a rewritten back-to-source path includes: rewriting the back-to-source path to obtain an initial back-to-source path with the domain name; obtaining parameters in a data back-to-source request; and rewriting to the rewritten back-to-source path according to the initial back-to-source path and the parameters.
[0066] Specifically, combined Figure 5 As shown, Figure 5 This is a flowchart of the rewriting steps in one embodiment. In this embodiment, the rewriting process of the back-to-source path mainly includes two steps. The first step is to construct the initial back-to-source path with the domain name, that is, to construct the member URI with the domain name. Then, the back-to-source and cached URIs are rewritten, keeping the parameters unchanged. The first step only constructs the required URI and temporarily stores it as a variable. The rewriting is not actually performed yet. The second step uses the variable in the first step to rewrite, keeping the parameters unchanged. This means that a link request may be followed by parameters, such as https: / / bixin.cn / m-ypp?source=1&test=1. The string after ? and ? is the parameter. The parameters are not fixed and can be spliced at will by the request initiator.
[0067] In one embodiment, after rewriting the back-to-source path according to the domain name to obtain the rewritten back-to-source path, it also includes: adding the rewritten back-to-source path to the request response header information; the method also includes: during debugging, querying and displaying the rewritten back-to-source path in the request response header information.
[0068] Specifically, continue to combine Figure 5 As shown in the figure, the response header (request response header information) has been newly added with X-CDN-FILE-PATH. X is a customary naming convention and is generally the prefix of custom header information. CDN-FILE-PATH is the CDN file path. This field is used to help developers check the actual back-to-source path and facilitate debugging and information completion.
[0069] In one embodiment, the data back-to-source method further includes: receiving a new domain name request, the new domain name request carrying at least one new domain name; configuring the new domain names to be the same source station; generating a first-level directory corresponding to the new domain name in the source station, and managing data corresponding to the new domain name under the first-level directory.
[0070] Specifically, this embodiment mainly describes the configuration process when adding a new domain name, where CDN adds multiple domain names. At this time, the source stations for multiple domain names are configured as the same source station, namely OSS Bucket, where the first-level directory in the source station corresponds to the domain name. Preferably, the name of the first-level directory in the source station is the corresponding domain name, that is, when a new domain name is added, a first-level folder of the same domain name is added to the OSS bucket, and files can be managed in the folder of the corresponding domain name, and files in multiple folders do not affect each other.
[0071] In one embodiment, after configuring the newly added domain name as the same source station, it also includes: configuring a back-to-source path rewriting rule for the newly added domain name; rewriting the back-to-source path according to the domain name to obtain a rewritten back-to-source path, including: obtaining the back-to-source path rewriting rule corresponding to the domain name; rewriting the back-to-source path according to the domain name through the back-to-source path rewriting rule to obtain a rewritten back-to-source path.
[0072] Specifically, configuring the back-to-source path rewriting rules for the newly added domain name means writing the core code for the edge script back-to-source path redirection; the back-to-source path rewriting rules mainly implement the following functions: constructing a back-to-source URI with a domain name, concatenating the domain name before the path, modifying the back-to-source and cached URIs, keeping the parameters unchanged, and adding X-CDN-FILE-PATH to the response header to identify the back-to-source redirection URI.
[0073] In the above example, multiple domain names are backed to the same OSS bucket. A CDN edge script is introduced to customize the back-to-origin logic. The edge script rewrites the back-to-origin path to include the domain name prefix. First-level folders in the OSS bucket are named after the domain name, facilitating the management of files across multiple domains.
[0074] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed 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 performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0075] Based on the same inventive concept, embodiments of the present application also provide a data return-to-source device for implementing the aforementioned data return-to-source method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more data return-to-source device embodiments provided below can be found in the limitations of the data return-to-source method above and will not be repeated here.
[0076] In one embodiment, Figure 6 As shown, a data return-to-source device is provided, comprising: a data return-to-source request receiving module 601, a rewriting module 602, and a return-to-source module 603, wherein:
[0077] The data tracing request receiving module 601 is used to receive a data tracing request, which carries a domain name and a tracing path.
[0078] Rewriting module 602, configured to rewrite the back-to-source path according to the domain name to obtain a rewritten back-to-source path, where the domain name in the rewritten back-to-source path corresponds to a first-level directory in the origin site, and the back-to-source path is the resource path under the first-level directory;
[0079] The back-to-source module 603 is configured to query the source station according to the rewritten back-to-source path to obtain corresponding data and return the queried data.
[0080] In one embodiment, the data return source device further includes:
[0081] The query module is used to query whether the corresponding data is cached in the node according to the rewrite-back 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, the source station is continued to be queried according to the rewrite-back source path to obtain the corresponding data.
[0082] In one embodiment, the rewriting module 602 includes:
[0083] A rewriting unit for rewriting the return source path back to the original path to obtain the initial return source path with a domain name;
[0084] A parameter acquisition unit for acquiring the parameters in the data return source request;
[0085] A first rewriting unit for rewriting according to the initial return source path and parameters to the rewritten return source path.
[0086] In one embodiment, the above data return source device further includes:
[0087] A rewriting module for adding the rewritten return source path to the request response header information;
[0088] A debugging module for querying and displaying the rewritten return source path in the request response header information during debugging.
[0089] In one embodiment, the above data return source device further includes:
[0090] A domain name adding module for receiving an adding domain name request, where the adding domain name request carries at least one adding domain name;
[0091] A source station configuration module for configuring the adding domain names to be the same source station;
[0092] A source station processing module for generating a first-level directory corresponding to the adding domain name in the source station and managing the data corresponding to the adding domain name under the first-level directory.
[0093] In one embodiment, the above data return source device further includes:
[0094] A rewriting rule configuration module for configuring the return source path rewriting rule for the adding domain name;
[0095] The above rewriting module 602 includes:
[0096] A rewriting rule acquisition unit for acquiring the return source path rewriting rule corresponding to the domain name;
[0097] A second rewriting unit for rewriting the return source path according to the domain name through the return source path rewriting rule to obtain the rewritten return source path.
[0098] Each module in the above data return source device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so as to facilitate the processor to call and execute the operations corresponding to the above modules.
[0099] In one embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 7As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing 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, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store back-to-source data. The input / output interface of the computer device is used to exchange information between the processor and an external device. 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 data back-to-source method is implemented.
[0100] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0101] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the following steps are implemented: receiving a data return-to-source request, the data return-to-source request carrying a domain name and a return-to-source path; rewriting the return-to-source path according to the domain name to obtain a rewritten return-to-source path, wherein the domain name in the rewritten return-to-source path corresponds to a first-level directory in a source station, and the return-to-source path is a resource path under the first-level directory; querying the source station according to the rewritten return-to-source path to obtain corresponding data, and returning the queried data.
[0102] In one embodiment, before the processor executes the computer program to query the source station according to the rewrite-back source path to obtain the corresponding data, it also includes: querying whether the corresponding data is cached in the node according to the rewrite-back source path; when the corresponding data is cached in the node, obtaining the corresponding data from the node and returning it; when the corresponding data is not cached in the node, continuing to query the source station according to the rewrite-back source path to obtain the corresponding data.
[0103] In one embodiment, the processor executes a computer program to rewrite the back-to-source path according to the domain name to obtain a rewritten back-to-source path, including: rewriting the back-to-source path to obtain an initial back-to-source path with the domain name; obtaining parameters in a data back-to-source request; and rewriting the back-to-source path to the rewritten back-to-source path according to the initial back-to-source path and the parameters.
[0104] In one embodiment, after the processor rewrites the back-to-source path according to the domain name to obtain the rewritten back-to-source path when executing the computer program, it also includes: adding the rewritten back-to-source path to the request response header information; when the processor executes the computer program, it also implements the following steps: during debugging, querying and displaying the rewritten back-to-source path in the request response header information.
[0105] In one embodiment, when the processor executes the computer program, it also implements the following steps: 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 station; generating a first-level directory corresponding to the new domain name in the source station, and managing data corresponding to the new domain name under the first-level directory.
[0106] In one embodiment, after configuring the newly added domain name as the same source station when the processor executes the computer program, it also includes: configuring a back-to-source path rewriting rule for the newly added domain name; when the processor executes the computer program, rewriting the back-to-source path according to the domain name to obtain a rewritten back-to-source path, including: obtaining the back-to-source path rewriting rule corresponding to the domain name; rewriting the back-to-source path according to the domain name through the back-to-source path rewriting rule to obtain a rewritten back-to-source path.
[0107] 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 return-to-source request, the data return-to-source request carrying a domain name and a return-to-source path; rewriting the return-to-source path according to the domain name to obtain a rewritten return-to-source path, wherein the domain name in the rewritten return-to-source path corresponds to a first-level directory in the source station, and the return-to-source path is a resource path under the first-level directory; querying the source station according to the rewritten return-to-source path to obtain corresponding data, and returning the queried data.
[0108] In one embodiment, before the computer program is executed by the processor and queries the source station according to the rewrite-back source path to obtain the corresponding data, it also includes: querying whether the corresponding data is cached in the node according to the rewrite-back source path; when the corresponding data is cached in the node, obtaining the corresponding data from the node and returning it; when the corresponding data is not cached in the node, continuing to query the source station according to the rewrite-back source path to obtain the corresponding data.
[0109] In one embodiment, when a computer program is executed by a processor, rewriting a back-to-source path according to a domain name to obtain a 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 a data back-to-source request; and rewriting to the rewritten back-to-source path according to the initial back-to-source path and the parameters.
[0110] In one embodiment, after the computer program, when executed by a processor, rewrites the origin path according to the domain name to obtain a rewritten origin path, the method further includes: adding the rewritten origin path to the request response header information; when the computer program is executed by a processor, the following steps are further implemented: during debugging, querying and displaying the rewritten origin path in the request response header information.
[0111] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented: receiving an add domain name request, where the add domain name request carries at least one added domain name; configuring the added domain names to the same origin; generating a first-level directory corresponding to the added domain name in the origin, and managing the data corresponding to the added domain name under the first-level directory.
[0112] In one embodiment, after the computer program, when executed by a processor, configures the added domain names to the same origin, the method further includes: configuring the origin path rewrite rule for the added domain names; when the computer program is executed by a processor, rewriting the origin path according to the domain name to obtain a rewritten origin path includes: obtaining the origin path rewrite rule corresponding to the domain name; and rewriting the origin path according to the domain name through the origin path rewrite rule to obtain a rewritten origin path.
[0113] In one embodiment, a computer program product is provided, including a computer program, which when executed by a processor, implements the following steps: receiving a data origin request, where the data origin request carries a domain name and an origin path; rewriting the origin path according to the domain name to obtain a rewritten origin path, where the domain name in the rewritten origin path corresponds to the first-level directory in the origin, and the origin path is the resource path under the first-level directory; querying the origin according to the rewritten origin path to obtain the corresponding data, and returning the queried data.
[0114] In one embodiment, before the computer program, when executed by a processor, queries the origin according to the rewritten origin path to obtain the corresponding data, the method further includes: querying whether the corresponding data is cached in the node according to the rewritten origin path; when the corresponding data is cached in the node, obtaining the corresponding data from the node and returning it; when the corresponding data is not cached in the node, then continuing with the step of querying the origin according to the rewritten origin path to obtain the corresponding data.
[0115] In one embodiment, when the computer program is executed by a processor, rewriting the origin path according to the domain name to obtain a rewritten origin path includes: rewriting the origin path to obtain an initial origin path with the domain name; obtaining the parameters in the data origin request; and rewriting to the rewritten origin path according to the initial origin path and the parameters.
[0116] In one embodiment, after the computer program is executed by a processor and rewrites the back-to-source path according to the domain name to obtain the rewritten back-to-source path, it also includes: adding the rewritten back-to-source path to the request response header information; when the computer program is executed by the processor, it also implements the following steps: during debugging, querying and displaying the rewritten back-to-source path in the request response header information.
[0117] 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 station; generating a first-level directory corresponding to the new domain name in the source station, and managing data corresponding to the new domain name under the first-level directory.
[0118] In one embodiment, after configuring the newly added domain name as the same source station, the computer program implemented when the processor is executed also includes: configuring a back-to-source path rewriting rule for the newly added domain name; when the computer program is executed by the processor, rewriting the back-to-source path according to the domain name to obtain a rewritten back-to-source path, including: obtaining the back-to-source path rewriting rule corresponding to the domain name; rewriting the back-to-source path according to the domain name using the back-to-source path rewriting rule to obtain a rewritten back-to-source path.
[0119] It should be noted that the user information (including but not limited to user device 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 information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions.
[0120] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0121] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0122] The above-described embodiments merely represent several implementation manners of the present application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A data return-to-source method, characterized in that, The method includes: Receiving a data source return request, where the data source return request carries a domain name and a source return path; Rewriting the source return path according to the domain name to obtain a rewritten source return path, where the domain name in the rewritten source return path corresponds to the first-level directory in the source site, and the source return path is the resource path under the first-level directory; Querying the source site according to the rewritten source return path to obtain corresponding data, and returning the queried data.
2. The method according to claim 1, wherein Before querying the source site according to the rewritten source return path to obtain corresponding data, it further includes: Querying whether the corresponding data is cached in the node according to the rewritten source return path; When the corresponding data is cached in the node, obtaining the corresponding data from the node and returning it; When the corresponding data is not cached in the node, then continue with the step of querying the source site according to the rewritten source return path to obtain corresponding data.
3. The method according to claim 1 or 2, characterized in that, The rewriting the source return path according to the domain name to obtain a rewritten source return path includes: Rewriting the source return path to obtain an initial source return path with a domain name; Obtaining the parameters in the data source return request; Rewriting to the rewritten source return path according to the initial source return path and the parameters.
4. The method according to claim 1 or 2, characterized in that, After rewriting the source return path according to the domain name to obtain a rewritten source return path, it further includes: Adding the rewritten source return path to the request response header information; The method further includes: During debugging, querying and displaying the rewritten source return path in the request response header information.
5. The method according to claim 1 or 2, characterized in that The method further includes: Receiving a new domain name request, where the new domain name request carries at least one new domain name; Configuring the new domain names to the same source site; Generating a first-level directory corresponding to the new domain name in the source site, and managing the data corresponding to the new domain name under the first-level directory.
6. The method according to claim 5, characterized in that After configuring the new domain names to the same source site, it further includes: Configuring the source return path rewriting rule for the new domain name; The rewriting the source return path according to the domain name to obtain a rewritten source return path includes: Obtaining the source return path rewriting rule corresponding to the domain name; Using the source return path rewriting rule to rewrite the source return path according to the domain name to obtain a rewritten source return path.
7. A data return-to-source device, characterized in that, The device includes: A data source return request receiving module, configured to receive a data source return request, where the data source return request carries a domain name and a source return path; A rewriting module, configured to rewrite the source return path according to the domain name to obtain a rewritten source return path, where the domain name in the rewritten source return path corresponds to the first-level directory in the source site, and the source return path is the resource path under the first-level directory; A source return module, configured to query the source site according to the rewritten source return path to obtain corresponding data, and return the queried data.
8. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Back-to-source processing method and device of CDN, and system
CN109660578A
Data processing method and device
CN110659154A