Disclosure of Invention
The invention provides a cross-border access accelerating method and device, and relates to a system for accelerating access to static resources such as pictures, CSS (cascading style sheets), JS (JS) and the like of a overseas website without using mirror image service when the overseas website is accessed.
The technical scheme of the invention comprises a cross-border access acceleration method, which is characterized by comprising the following steps: A. when an internal user accesses an oversea website, acquiring oversea website data accessed by the user, wherein the website data is a website code; B. converting the link address of the static resource in the overseas website data, and caching the converted static resource to a transfer server; C. and when the domestic user visits the corresponding foreign website again, loading the corresponding static resource from the transit server through the converted link address of the website.
According to the cross-border access acceleration method, the step A specifically comprises the following steps: detecting an overseas website accessed by a user, and acquiring an address of the overseas website; and setting a corresponding plug-in at a corresponding overseas website, and acquiring the static resource link and the corresponding static resource data of the website.
According to the cross-border access acceleration method, a plug-in is an Nginx plug-in.
According to the cross-border access acceleration method, the step B specifically comprises the following steps: loading HTML codes, and converting link addresses of static resources in the codes, wherein the converted link addresses of the static resources comprise but are not limited to pictures, cascading style sheets and JS scripts, the conversion comprises adding link addresses for jumping to a transit server in the static resources, and correspondingly, the conversion also comprises caching the static resources to the transit server.
According to the cross-border access acceleration method, the step B of converting the link address of the static resource in the code specifically includes: integrating the cascading style sheet code segments in the HTML codes into a cascading style sheet file, and caching the cascading style sheet file in an internal transit server; integrating JS script code segments in the HTML codes into a JS file, and caching the JS file in a domestic transit server; and converting and caching the picture resources loaded in the cascading style sheet file in a domestic transfer server.
According to the cross-border access acceleration method, the step B specifically comprises the following steps: when the system is used for visiting the corresponding foreign websites again, the converted HTML codes are loaded, and the cached static resources are directly loaded from the internal server.
In a preferred embodiment, the method further comprises: and monitoring the converted website, and if the website content is changed, acquiring the changed static link to perform corresponding address conversion and static resource caching, wherein the monitoring time interval can be set in a user-defined manner.
In a preferred embodiment, the method further comprises: and the user-defined setting obtains the static resources of the converted overseas website, and deletes the static resources cached in the history after the cache of the static resources is updated.
The technical scheme of the invention also comprises cross-border access acceleration for executing any method, and the device comprises a Web memory, a transfer memory, a Web processor and a transfer processor, and is characterized in that: the Web processor is used for acquiring the data of the overseas website accessed by the user when the overseas website is accessed by the domestic user, wherein the website data is a website code, converting the link address of the static resource in the overseas website data, and caching the converted static resource to the transfer server; the Web memory is used for storing data acquired by the overseas website; the transit processor is used for loading corresponding static resources from the transit server through the converted link address of the website when the domestic user visits the corresponding overseas website again; the transit storage is used for caching the converted static resources of the overseas website.
The invention has the beneficial effects that: the loading speed of accessing the static resources of the overseas website is improved.
Detailed Description
The conception, the specific structure and the technical effects of the present invention will be clearly and completely described in conjunction with the embodiments and the accompanying drawings to fully understand the objects, the schemes and the effects of the present invention.
It should be noted that, unless otherwise specified, when a feature is referred to as being "fixed" or "connected" to another feature, it may be directly fixed or connected to the other feature or indirectly fixed or connected to the other feature. Furthermore, the descriptions of upper, lower, left, right, etc. used in the present disclosure are only relative to the mutual positional relationship of the constituent parts of the present disclosure in the drawings. As used in this disclosure, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. Furthermore, unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the term "and/or" includes any combination of one or more of the associated listed items.
It will be understood that, although the terms first, second, third, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element of the same type from another. For example, a first element could be termed a second element, and, similarly, a second element could be termed a first element, without departing from the scope of the present disclosure. The use of any and all examples, or exemplary language ("e.g.," such as "or the like") provided herein, is intended merely to better illuminate embodiments of the invention and does not pose a limitation on the scope of the invention unless otherwise claimed.
Fig. 1 shows a general flow chart of the method according to the invention. The method specifically comprises the following steps: A. when an internal user accesses an oversea website, acquiring oversea website data accessed by the user, wherein the website data is a website code; B. converting the link address of the static resource in the overseas website data, and caching the converted static resource to a transfer server; C. and when the domestic user visits the corresponding foreign website again, loading the corresponding static resource from the transit server through the converted link address of the website.
Fig. 2 shows a flow chart according to a first embodiment of the invention. The method specifically comprises the following steps:
(1) installing a conversion plug-in on a server of the overseas website;
(2) accessing the website through the visitor to acquire a website HTML code;
(3) converting link addresses of static resources such as pictures, CSS and JS in the HTML codes;
(4) caching the static resources through a domestic static resource transfer server;
(5) integrating the CSS code segments in the HTML codes into a CSS file, and caching the CSS file in a domestic transfer server;
(6) integrating JS code segments in the HTML codes into a JS file, and caching the JS file in a domestic transit server;
(7) converting and caching the picture resources loaded in the CSS file in a domestic transit server;
(8) the visitor loads the converted HTML code;
(9) and the visitor directly loads the static resource from the domestic transit server.
The method comprises the following steps:
converting the picture address in the html code, such as < img src ═ 1.jpg '>, to < img src ═ http:// cdn. NICecdn. com/test.com/1. jpg' >;
converting CSS file address conversion in the html code, such as < link href ═ 1.CSS '>, into < link href ═ http:// cdn.nicancedcn.com/test.com/1. CSS' >;
converting the JS file address in the html code, such as < script src ═ 1.JS >, into < script src ═ http:// cdn.niceden.com/test.com/1.JS >;
in the domestic transit server, the nginx builds service, can cache the static resources to the domestic server, and when domestic visitors load the static resources from the domestic transit server, the speed is faster than that of overseas;
the CSS code segments in the HTML codes are integrated into CSS files, so that the volume capacity of HTML codes can be reduced, the HTML codes are cached in a domestic transfer server, and the CSS code segments can be quickly loaded out;
js code segments in HTML codes are integrated into js files, so that the volume capacity of HTML codes can be reduced, and the HTML codes are cached in a domestic transfer server and can be quickly loaded out;
the cache duration can be freely set by updating the cache, such as 1 day, 7 days, 1 month, 1 hour, and the like, and is minimum 1 hour.
The server plug-in at the overseas website can also determine whether the static resource has an update, if so, the cache of the resource file is emptied, for example, if 1.jpg has an update, the conversion address is added with a timestamp to change to < img src ═ http:// cdn.
Fig. 3 shows a schematic view of the device according to the invention. The method comprises the following steps: the Web processor is used for acquiring the data of the overseas website accessed by the user when the overseas website is accessed by the domestic user, wherein the website data is a website code, converting the link address of the static resource in the overseas website data, and caching the converted static resource to the transfer server; the Web memory is used for storing data acquired by the overseas website; the transit processor is used for loading corresponding static resources from the transit server through the converted link address of the website when the domestic user visits the corresponding overseas website again; the transit storage is used for caching the converted static resources of the outbound website.
It should be recognized that embodiments of the present invention can be realized and implemented by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer readable memory. The methods may be implemented in a computer program using standard programming techniques, including a non-transitory computer-readable storage medium configured with the computer program, where the storage medium so configured causes a computer to operate in a specific and predefined manner, according to the methods and figures described in the detailed description. Each program may be implemented in a high level procedural or object oriented programming language to communicate with a computer system. However, the program(s) can be implemented in assembly or machine language, if desired. In any case, the language may be a compiled or interpreted language. Furthermore, the program can be run on a programmed application specific integrated circuit for this purpose.
Further, the operations of processes described herein can be performed in any suitable order unless otherwise indicated herein or otherwise clearly contradicted by context. The processes described herein (or variations and/or combinations thereof) may be performed under the control of one or more computer systems configured with executable instructions, and may be implemented as code (e.g., executable instructions, one or more computer programs, or one or more applications) collectively executed on one or more processors, by hardware, or combinations thereof. The computer program includes a plurality of instructions executable by one or more processors.
Further, the method may be implemented in any type of computing platform operatively connected to a suitable interface, including but not limited to a personal computer, mini computer, mainframe, workstation, networked or distributed computing environment, separate or integrated computer platform, or in communication with a charged particle tool or other imaging device, and the like. Aspects of the invention may be embodied in machine-readable code stored on a non-transitory storage medium or device, whether removable or integrated into a computing platform, such as a hard disk, optically read and/or write storage medium, RAM, ROM, or the like, such that it may be read by a programmable computer, which when read by the storage medium or device, is operative to configure and operate the computer to perform the procedures described herein. Further, the machine-readable code, or portions thereof, may be transmitted over a wired or wireless network. The invention described herein includes these and other different types of non-transitory computer-readable storage media when such media include instructions or programs that implement the steps described above in conjunction with a microprocessor or other data processor. The invention also includes the computer itself when programmed according to the methods and techniques described herein.
A computer program can be applied to input data to perform the functions described herein to transform the input data to generate output data that is stored to non-volatile memory. The output information may also be applied to one or more output devices, such as a display. In a preferred embodiment of the invention, the transformed data represents physical and tangible objects, including particular visual depictions of physical and tangible objects produced on a display.
The above description is only a preferred embodiment of the present invention, and the present invention is not limited to the above embodiment, and any modifications, equivalent substitutions, improvements, etc. within the spirit and principle of the present invention should be included in the protection scope of the present invention as long as the technical effects of the present invention are achieved by the same means. The invention is capable of other modifications and variations in its technical solution and/or its implementation, within the scope of protection of the invention.