A resource response method, device, equipment and storage medium

By intercepting and redirecting the resource request message, the problem of static resource path leakage is solved and the security of resource files is improved.

CN119939638BActive Publication Date: 2025-07-11HANGZHOU XINZHONGDA ENTERPRISE MANAGEMENT TECHNOLOGY CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510429458.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2025-07-11
Estimated Expiration
2045-04-08

AI Technical Summary

Technical Problem

In the current network environment, when accessing resource files through static resource paths, hackers or illegal personnel can directly obtain the content of the resource file, resulting in leakage.

Method used

Intercept the response result of the target resource request message, determine the target resource storage address, and generate the redirect address and valid duration, and generate the target resource response result through the redirect address.

Benefits of technology

It avoids direct access to the static storage address of the resource file, improves the security of the resource file and prevents leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119939638B_ABST
    Figure CN119939638B_ABST
Patent Text Reader

Abstract

The present invention discloses a resource response method, apparatus, device and storage medium. The resource response method includes: responding to a target resource request message, intercepting the resource response result of the target resource request message, and determining the storage address of the target resource; generating a redirect address for the target resource file based on the storage address of the target resource and the target resource file stored in the storage address of the target resource, and determining the valid duration of the redirect address; and generating a target resource response result of the target resource request message according to the redirect address when the redirect address is a valid address. Through the above technical solution, the security of the resource file in the resource response process is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a resource response method, apparatus, device, and storage medium. Background Art

[0002] In the current development of business application systems, the client will request a large number of resource files from the server, such as pictures, files, audio and video, etc. Most of the resource files on the server are stored statically. The client will directly access the resource files on the server locally through the static resource path to improve the resource loading speed.

[0003] However, in the current network environment, when accessing resource files in the above manner, if hackers or illegal personnel obtain the static resource path of the resource files, they can directly access the resource files, resulting in the leakage of the content of the resource files. Summary of the Invention

[0004] The present invention provides a resource response method, apparatus, device, and storage medium to prevent the leakage of resource files and improve the security of resource files during the resource access process.

[0005] According to one aspect of the present invention, a resource response method is provided. The method includes:

[0006] Respond to a target resource request message, intercept the resource response result of the target resource request message, and determine the target resource storage address;

[0007] Based on the target resource storage address and the target resource file stored in the target resource storage address, generate a redirect address for the target resource file, and determine the valid duration of the redirect address;

[0008] In the case where the redirect address is a valid address, generate a target resource response result for the target resource request message according to the redirect address.

[0009] According to another aspect of the present invention, a resource response apparatus is provided. The apparatus includes:

[0010] An interception module, configured to respond to a target resource request message, intercept the resource response result of the target resource request message, and determine the target resource storage address;

[0011] A redirect module, configured to generate a redirect address for the target resource file based on the target resource storage address and the target resource file stored in the target resource storage address, and determine the valid duration of the redirect address;

[0012] A response module, configured to generate a target resource response result of a target resource request message according to the redirect address when the redirect address is a valid address.

[0013] According to another aspect of the present invention, there is provided an electronic device, which includes:

[0014] At least one processor; and

[0015] A memory communicatively connected to the at least one processor; wherein,

[0016] The memory stores a computer program executable by the at least one processor, and when the computer program is executed by the at least one processor, the at least one processor is enabled to execute the resource response method according to any embodiment of the present invention.

[0017] According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for implementing the resource response method according to any embodiment of the present invention when executed by a processor.

[0018] According to another aspect of the present invention, there is provided a computer program including a computer program product, and when the computer program product is executed by a processor, it implements the resource response method according to any embodiment of the present invention.

[0019] The technical solution of the embodiment of the present invention intercepts the response result of the target resource request message, redirects the resource storage address of the target resource file requested by the target resource request message, sets the valid duration of the redirected resource storage address, and generates the target resource corresponding result of the target resource request message according to the redirected resource storage address of the target resource file, avoiding direct access to the resource file according to the static storage address of the resource file on the server side, resulting in resource file leakage, and improving the security of the resource file.

[0020] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. Description of the Drawings

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0022] Figure 1 It is a flowchart of a resource response method provided in Embodiment 1 of the present invention;

[0023] Figure 2 It is a flowchart of a resource response method provided in Embodiment 2 of the present invention;

[0024] Figure 3 It is a schematic structural diagram of a resource response device provided in Embodiment 3 of the present invention;

[0025] Figure 4 It is a schematic structural diagram of an electronic device for implementing the resource response method of the embodiments of the present invention. Detailed implementation manners

[0026] In order to enable those skilled in the art to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.

[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0028] Embodiment 1

[0029] Figure 1 This is a flowchart of a resource response method provided in Embodiment 1 of the present invention. This embodiment is applicable to the situation where the server side responds to a resource request message. This method can be executed by a resource response device, which can be implemented in the form of hardware and / or software, and the resource response device can be configured in various general computing devices, such as server devices. As Figure 1 shown, this method includes:

[0030] S110. Respond to the target resource request message, intercept the resource response result of the target resource request message, and determine the target resource storage address.

[0031] Among them, the target resource request message can be a request message sent by the client to request a target resource file; the target resource storage address can refer to the storage address of the target resource file requested by the client on the server side; it should be noted that a target resource request message can request access to multiple target resource files, that is, the target resource storage address can include the storage addresses of at least one target resource file.

[0032] Specifically, after receiving the target resource request message sent by the client, the server side can respond to it. After obtaining the response result by responding to the target resource request message, the server side will not directly return the response result to the client, but will first intercept the response result to determine whether there is a target resource storage address in the response result.

[0033] Optionally, in the embodiment of the present invention, intercepting the resource response result of the target resource request message and determining the target resource storage address includes: generating a regular expression for detecting the uniform resource locator according to the composition structure of the uniform resource locator; intercepting the resource response result of the target resource request message according to the regular expression to determine the target resource storage address.

[0034] Specifically, the server side can build a URL (Uniform Resource Locator) interceptor. Before returning the resource response result of the target resource request message to the client, it can first perform character matching on the string in the resource response result, intercept the resource response result carrying the URL, and use the URL as the target resource storage address to reconstruct the URL in the resource response result and then return it to the client. Optionally, the URL interceptor can be a regular expression for detecting the uniform resource locator, and the regular expression can be determined according to information such as the protocol (such as http, https), domain name, port number, path, query parameters, and fragment identifier of the URL.

[0035] Optionally, in the embodiments of the present invention, the server side may perform resource detection on the intercepted resource response result, that is, according to the URL information in the resource response result, access the URL to determine whether the resource directory and resource file corresponding to the URL can be obtained; if it can be obtained, file resource access blocking is enabled, that is, the URL and the resource file corresponding to the URL are encrypted to ensure the security of the resource file. In an alternative embodiment, the resource file object can be enhanced by bytecode enhancement. After the new resource file object is created, the resource file object can be automatically encrypted according to the custom encryption method configured in the enhanced file class. It should be noted that the encryption methods for the URL and the resource file can be adaptively set by those skilled in the art.

[0036] In an alternative embodiment of the present invention, a static resource file scanner can also be set to scan and access the static resource files stored on the server side at a preset period to determine whether the static resource file can be directly accessed. If it can be directly accessed, the static resource file is encrypted.

[0037] By encrypting the static resource file path (URL) and the static resource file, the risk of being accessed by the outside world is avoided, and the security of the static resource file is improved.

[0038] S120. Generate a redirect address for the target resource file based on the target resource storage address and the target resource file stored in the target resource storage address, and determine the valid duration of the redirect address.

[0039] S130. When the redirect address is a valid address, generate a target resource response result for the target resource request message according to the redirect address.

[0040] Among them, the valid address may refer to the redirect address within the valid duration.

[0041] In the embodiments of the present invention, the redirect address of the target resource file can be determined according to the encrypted target resource storage address, and the valid duration of the redirect address can be determined through the target resource file. Within the valid duration, the redirect address can be used as the target resource response result of the target resource request message to provide an access function to the client. If the redirect address becomes invalid, the access function cannot be provided continuously, and the resource file stored in the redirect address will be cleared.

[0042] The technical solution of the embodiment of the present invention intercepts the response result of the target resource request message, redirects the resource storage address of the target resource file requested by the target resource request message, and sets the valid duration of the redirected resource storage address. The target resource corresponding result of the target resource request message is generated according to the resource storage address of the redirected target resource file, avoiding direct access to the resource file according to the static storage address of the resource file on the server side, resulting in resource file leakage, and improving the security of the resource file.

[0043] Embodiment 2

[0044] Figure 2 The flowchart of a resource response method provided by Embodiment 2 of the present invention is further refined on the basis of the above embodiment, and provides specific steps for generating the redirected address of the target resource file based on the target resource storage address and the target resource file stored in the target resource storage address, and determining the valid duration of the redirected address. It should be noted that for the parts not detailed in the embodiments of the present invention, reference can be made to the relevant descriptions of other embodiments, which will not be elaborated here. As Figure 2 shown, the method includes:

[0045] S210. Respond to the target resource request message, intercept the resource response result of the target resource request message, and determine the target resource storage address.

[0046] S220. Encrypt the target resource storage address, and use the encrypted address as the redirected address corresponding to the target resource storage address; and back up the target resource file stored in the target resource storage address and store it in the redirected address.

[0047] S230. Determine the address valid duration of the redirected address according to the file size of the target resource file stored in the target resource storage address and the preset file transfer rate.

[0048] In the embodiment of the present invention, after the redirected address is determined, the target resource file stored in the target resource storage address can be backed up, and the backed-up target resource file is stored in the redirected address. If it is found that the target resource file is an encrypted file during the backup process of the target resource file, the backed-up target resource file is decrypted and then stored in the redirected address.

[0049] Furthermore, the download time required for the target resource file can be determined according to the file size of the target resource file stored in the redirected address and the pre-set file transfer rate, and the address valid duration of the redirected address can be determined according to the download time and the preset effective redundancy time. Optionally, the file transfer rate can be adaptively set by those skilled in the art.

[0050] Optionally, in the embodiments of the present invention, determining the address valid duration of the redirection address according to the file size of the target resource file stored in the target resource storage address includes: when there are at least two resource addresses of resource files in the target resource storage address, sorting the resource addresses in the order of their appearance in the target resource storage address to generate an address response sequence; and generating the address valid duration of the redirection address corresponding to the resource address in sequence according to the arrangement order of the resource addresses in the address response sequence. It should be noted that the address valid duration of the redirection address corresponding to the resource address arranged later in the address response sequence is determined based on the address valid duration of the redirection address corresponding to the resource address before it.

[0051] Specifically, if the target resource request message sent by the client requests access to at least two resource files, that is, when there are at least two resource addresses of resource files in the target resource storage address, considering the impact of downloading multiple resource files on bandwidth, therefore, by setting a secondary redundant duration for the resource addresses arranged later in the address response sequence, the stability of the redirection address corresponding to the resource address is ensured. For example, the address response sequence includes path A and path B, path A is arranged before path B, and the address valid duration of the redirection address corresponding to path A is 30 seconds, then the final address valid duration of the redirection address corresponding to path B needs to accumulate the address valid duration of the redirection address corresponding to path A, that is, the initial duration of the address valid duration of the redirection address corresponding to path B is 30 seconds instead of 0 seconds.

[0052] In an optional implementation manner of the embodiments of the present invention, when there are at least two resource addresses of resource files in the target resource storage address, access monitoring is performed on the redirection addresses corresponding to the resource addresses in the address response sequence; if within a preset access period, the redirection address corresponding to any resource address in the address response sequence is not accessed, the to-be-invalidated address queue is cleared.

[0053] It should be noted that when there are at least two resource addresses of resource files in the target resource storage address, if the redirection address corresponding to the resource address becomes invalid, the redirection address is stored in the to-be-invalidated address queue; among them, the redirection addresses in the to-be-invalidated address queue will be re-enabled within a preset recovery period. Optionally, the preset access period and the preset recovery period can be adaptively set by those skilled in the art.

[0054] Among them, the redirection addresses in the to-be-invalidated address queue will be re-enabled within a preset recovery period, and one address response sequence corresponds to one to-be-invalidated address queue.

[0055] In the embodiments of the present invention, the client does not necessarily use all the resource files requested for access simultaneously. For example, the user accesses the resource files requested for access in an irregular and random manner by swiping or flipping the page on the client. In order to ensure that the client can always access the redirect address corresponding to the resource address in the address response sequence, the redirect addresses in the to-be-invalidated address queue are re-enabled regularly to prevent the client from being unable to access due to the expiration of the address validity period of the redirect address.

[0056] Optionally, in the embodiments of the present invention, it further includes: if the access monitoring result of the redirect address corresponding to the resource address in the address response sequence is an orderly access with time regularity, such as periodic access with a preset fixed access period, the to-be-invalidated address queue is cleared to prevent illegal access by illegal users.

[0057] S240. When the redirect address is a valid address, generate a target resource response result of the target resource request message according to the redirect address.

[0058] The technical solution of the embodiments of the present invention determines the redirect address corresponding to the target resource storage address according to the encrypted target resource storage address, ensuring the address security of the redirect address. And by setting the address validity period of the redirect address according to the size of the target resource file, the security of the resource file is further improved. On the one hand, it prevents illegal users from directly accessing the real storage location of the resource file. At the same time, by setting the address validity period, the interaction security level in the resource response process is improved.

[0059] Embodiment III

[0060] Figure 3 FIG. is a schematic structural diagram of a resource response device provided in Embodiment III of the present invention. As Figure 3 shown, the device includes:

[0061] An interception module 310, configured to respond to a target resource request message, intercept the resource response result of the target resource request message, and determine the target resource storage address;

[0062] A redirect module 320, configured to generate a redirect address of the target resource file based on the target resource storage address and the target resource file stored in the target resource storage address, and determine the validity period of the redirect address;

[0063] A response module 330, configured to generate a target resource response result of the target resource request message according to the redirect address when the redirect address is a valid address.

[0064] In the technical solution of the embodiment of the present invention, by intercepting the response result of the target resource request message, redirecting the resource storage address of the target resource file requested by the target resource request message, and setting the valid duration of the resource storage address after redirection, and generating the target resource corresponding result of the target resource request message according to the resource storage address of the target resource file after redirection, it is avoided that the resource file can be directly accessed according to the static storage address of the resource file on the server side, resulting in the leakage of the resource file, and the security of the resource file is improved.

[0065] Optionally, the redirection module 320 includes:

[0066] An address determination unit, configured to encrypt the target resource storage address, and use the encrypted address as the redirection address corresponding to the target resource storage address; and back up the target resource file stored in the target resource storage address, and store it in the redirection address;

[0067] A duration determination unit, configured to determine the address valid duration of the redirection address according to the file size of the target resource file stored in the target resource storage address and the preset file transfer rate.

[0068] Optionally, the duration determination unit may be specifically configured to:

[0069] In the case that there are at least two resource addresses in the target resource storage address, sort the resource addresses in the order of their appearance in the target resource storage address to generate an address response sequence;

[0070] According to the arrangement order of the resource addresses in the address response sequence, sequentially generate the address valid durations of the redirection addresses corresponding to the resource addresses; wherein, the address valid duration of the redirection address corresponding to the resource address arranged later in the address response sequence is determined based on the address valid duration of the redirection address corresponding to the resource address before this resource address.

[0071] Optionally, the device further includes:

[0072] An address cleaning module, configured to clean the to-be-invalidated address queue if the redirection address corresponding to any resource address in the address response sequence is not accessed within the preset access period; wherein, the redirection addresses in the to-be-invalidated address queue will be re-enabled within the preset recovery period, and one address response sequence corresponds to one to-be-invalidated address queue.

[0073] Optionally, the address cleaning module further includes:

[0074] A to-be-invalidated queue generation unit, configured to, when there are at least two resource addresses of resource files in the target resource storage address, deposit the redirected address into a to-be-invalidated address queue if the redirected address corresponding to the resource address becomes invalid; wherein, the redirected addresses in the to-be-invalidated address queue will be re-enabled within a preset recovery period.

[0075] Optionally, the interception module 310 may specifically be configured to:

[0076] Generate a regular expression for detecting a uniform resource locator according to the composition structure of the uniform resource locator;

[0077] Intercept the resource response result of the target resource request message according to the regular expression to determine the target resource storage address.

[0078] The resource response device provided by the embodiments of the present invention can execute the resource response method provided by any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution of the method.

[0079] Embodiment 4

[0080] Figure 4 FIG. shows a schematic structural diagram of an electronic device 410 that can be used to implement the embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as, for example, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, for example, a personal digital processor, a cellular phone, a smart phone, a wearable device (such as a helmet, glasses, a watch, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0081] As Figure 4 shown, the electronic device 410 includes at least one processor 411, and a memory communicatively connected to at least one processor 411, such as a read-only memory (ROM) 412, a random access memory (RAM) 413, etc., wherein the memory stores a computer program executable by at least one processor, and the processor 411 can execute various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 412 or the computer program loaded from the storage unit 418 into the random access memory (RAM) 413. In the RAM 413, various programs and data required for the operation of the electronic device 410 can also be stored. The processor 411, the ROM 412, and the RAM 413 are connected to each other through a bus 414. The input / output (I / O) interface 415 is also connected to the bus 414.

[0082] Multiple components in the electronic device 410 are connected to the I / O interface 415, including: an input unit 416, such as a keyboard, a mouse, etc.; an output unit 417, such as various types of displays, speakers, etc.; a storage unit 418, such as a disk, an optical disc, etc.; and a communication unit 419, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 419 allows the electronic device 410 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0083] The processor 411 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The processor 411 executes the various methods and processes described above, such as the resource response method.

[0084] In some embodiments, the resource response method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as the storage unit 418. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 410 via the ROM 412 and / or the communication unit 419. When the computer program is loaded into the RAM 413 and executed by the processor 411, one or more steps of the resource response method described above can be executed. Alternatively, in other embodiments, the processor 411 can be configured to execute the resource response method in any other suitable way (e.g., by means of firmware).

[0085] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special or general programmable processor, receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0086] A computer program for implementing the method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer programs are executed by the processor, the functions / operations specified in the flowchart and / or block diagram are implemented. The computer programs can be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0087] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0088] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and the input received from the user can be in any form (including acoustic input, speech input, or tactile input).

[0089] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.

[0090] A computing system can include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The client-server relationship is created by computer programs running on respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, solving the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.

[0091] It should be understood that various forms of the processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in the present invention can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is made herein.

[0092] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.

Claims

1. A resource response method, characterized in that, Including: Respond to the target resource request message, intercept the resource response result of the target resource request message, and determine the target resource storage address; Encrypt the address of the target resource storage address, and use the encrypted address as the redirect address corresponding to the target resource storage address; and back up the target resource file stored in the target resource storage address and store it in the redirect address; Determine the address valid duration of the redirect address according to the file size of the target resource file stored in the target resource storage address and the preset file transfer rate; When the redirect address is a valid address, generate the target resource response result of the target resource request message according to the redirect address; Among them, determining the address valid duration of the redirect address according to the file size of the target resource file stored in the target resource storage address and the preset file transfer rate further includes: When there are at least two resource addresses of resource files in the target resource storage address, sort the resource addresses in the order of their appearance in the target resource storage address to generate an address response sequence; Generate the address valid duration of the redirect address corresponding to the resource address in sequence according to the arrangement order of the resource addresses in the address response sequence; among them, the initial duration of the address valid duration of the redirect address corresponding to the resource address arranged later in the address response sequence is the address valid duration of the redirect address corresponding to the resource address before this resource address.

2. The method according to claim 1, wherein Also including: When there are at least two resource addresses of resource files in the target resource storage address, perform access monitoring on the redirect addresses corresponding to the resource addresses in the address response sequence; If within the preset access period, the redirect address corresponding to any resource address in the address response sequence is not accessed, clean up the queue of addresses to be invalidated; among them, the redirect addresses in the queue of addresses to be invalidated will be re-enabled within the preset recovery period, and one address response sequence corresponds to one queue of addresses to be invalidated.

3. The method according to claim 2, wherein Also including: When there are at least two resource addresses of resource files in the target resource storage address, if the redirect address corresponding to this resource address becomes invalid, store this redirect address in the queue of addresses to be invalidated; among them, the redirect addresses in the queue of addresses to be invalidated will be re-enabled within the preset recovery period.

4. The method according to claim 1, characterized in that, Intercepting the resource response result of the target resource request message and determining the target resource storage address includes: Generate a regular expression for detecting the uniform resource locator according to the composition structure of the uniform resource locator; Intercept the resource response result of the target resource request message according to this regular expression and determine the target resource storage address.

5. A resource response device, characterized in that, Including: An interception module, configured to respond to the target resource request message, intercept the resource response result of the target resource request message, and determine the target resource storage address; A redirect module, configured to generate a redirect address of the target resource file based on the target resource storage address and the target resource file stored in the target resource storage address, and determine the valid duration of the redirect address; A response module, configured to generate a target resource response result of a target resource request message according to the redirect address when the redirect address is a valid address; Wherein, the redirect module includes: An address determination unit, configured to encrypt the target resource storage address, and use the encrypted address as the redirect address corresponding to the target resource storage address; and back up the target resource file stored in the target resource storage address and store it in the redirect address; A duration determination unit, configured to determine the address valid duration of the redirect address according to the file size of the target resource file stored in the target resource storage address and a preset file transfer rate; Wherein, the duration determination unit is further configured to: When there are at least two resource addresses of resource files in the target resource storage address, sort the resource addresses in the order of their appearance in the target resource storage address to generate an address response sequence; Generate the address valid duration of the redirect address corresponding to the resource address in sequence according to the arrangement order of the resource addresses in the address response sequence; wherein, the initial duration of the address valid duration of the redirect address corresponding to the resource address arranged later in the address response sequence is the address valid duration of the redirect address corresponding to the resource address arranged before this resource address.

6. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the resource response method according to any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions, and the computer instructions are used to implement the resource response method according to any one of claims 1-4 when executed by a processor.

8. A computer program product, characterized in that, Including a computer program, which implements the resource response method according to any one of claims 1-4 when executed by a processor.

Citation Information

Patent Citations

  • Content distribution network system and method applicable to multi-service fusion

    CN101242422A

  • Anti-hotlinking management and control method for cloud platform, downloading platform and equipment

    CN112866272A