CN113132447A - Reverse proxy method and system - Google Patents

Reverse proxy method and system Download PDF

Info

Publication number
CN113132447A
CN113132447A CN202010041946.8A CN202010041946A CN113132447A CN 113132447 A CN113132447 A CN 113132447A CN 202010041946 A CN202010041946 A CN 202010041946A CN 113132447 A CN113132447 A CN 113132447A
Authority
CN
China
Prior art keywords
configuration file
target
domain name
reverse proxy
cache
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010041946.8A
Other languages
Chinese (zh)
Inventor
陈鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202010041946.8A priority Critical patent/CN113132447A/en
Publication of CN113132447A publication Critical patent/CN113132447A/en
Pending legal-status Critical Current

Links

Classifications

    • H04L67/56
    • H04L61/4511
    • H04L67/5683
    • H04L67/63

Abstract

The invention discloses a reverse proxy method and a reverse proxy system, and relates to the technical field of computers. A specific embodiment of the domain name management method includes: analyzing a target domain name corresponding to the application program to be accessed from the access request; acquiring a target configuration file corresponding to the target domain name; the target configuration file comprises a domain name, a release address and an application resource of the application program to be accessed; reverse proxying is performed based on the target profile. According to the implementation mode, the problems that the online process is complex, mistakes are easy to occur and decoupling of application and domain name management cannot be realized due to the fact that the configuration file is manually generated and then packaged and uploaded to the server when the application program is online at each time can be solved, one-key publishing of the configuration file is realized, unified domain name management can be realized, and statistics and monitoring are easy.

Description

Reverse proxy method and system
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and a system for reverse proxy.
Background
As traffic evolves and iterates, more and more independent domain names are accumulated for each level of channel pages of an application. In the prior art, each time an application program is online, a configuration file needs to be manually generated and then packaged and uploaded to a server.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
(1) the online process is complex and is easy to make mistakes;
(2) the device cannot be automatically on-line at regular time and needs to be manually on duty;
(3) no off-line operation is performed, and the later maintenance cost is high;
(4) decoupling of applications from domain name management cannot be achieved.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and a system for reverse proxy, which can avoid the problems that an online process is complex, error is easy to occur, and decoupling of application and domain name management cannot be realized due to the fact that an application program manually generates a configuration file and then packages and uploads the configuration file to a server when the application program is online every time, so that one-key publishing of the configuration file is realized, and meanwhile, unified management of a domain name is realized, and statistics and monitoring are easy.
According to a first aspect of the embodiments of the present invention, there is provided a reverse proxy method, including:
analyzing a target domain name corresponding to the application program to be accessed from the access request;
acquiring a target configuration file corresponding to the target domain name; the target configuration file comprises a domain name, a release address and an application resource of the application program to be accessed;
reverse proxying is performed based on the target profile.
Optionally, the target configuration file is a configuration file of a test state generated and issued in response to a domain name creation request in advance, or a configuration file of an online state generated and issued in response to a domain name issue request in advance according to the configuration file of the test state.
Optionally, the configuration file is verified and verified before being released.
Optionally, the issuing means: storing the configuration file to a database, or storing the configuration file to the database and synchronizing the configuration file to a cache; acquiring a target configuration file corresponding to the target domain name, wherein the acquiring comprises the following steps:
judging whether a target configuration file corresponding to the target domain name exists in a cache or not; if yes, obtaining the target configuration file from a cache; otherwise, the target configuration file is obtained from the database.
Optionally, the target configuration file further includes: a version identification; judging whether a target configuration file corresponding to the target domain name exists in the cache or not, wherein the judging step comprises the following steps:
determining a target version identification corresponding to the target domain name according to a preset reverse proxy rule; judging whether a configuration file with the target domain name and the target version identification exists in a cache; if yes, judging that the target configuration file exists in the cache; otherwise, judging that the target configuration file does not exist in the cache.
Optionally, the method for domain name management in the embodiment of the present invention is further characterized in that: responding to the configuration updating message, acquiring a configuration file from the database and storing the configuration file to a cache; or, the configuration file is obtained from the database through the timing task and is stored to the cache.
According to a second aspect of embodiments of the present invention, there is provided a reverse proxy system including:
the analysis unit is used for analyzing the target domain name corresponding to the application program to be accessed from the access request;
the acquisition unit is used for acquiring a target configuration file corresponding to the target domain name; the target configuration file is generated and issued by adopting the method provided by the first aspect of the embodiment of the invention;
and the proxy unit performs reverse proxy based on the target configuration file.
Optionally, the target configuration file is a configuration file of a test state generated and issued in response to a domain name creation request in advance, or a configuration file of an online state generated and issued in response to a domain name issue request in advance according to the configuration file of the test state.
Optionally, the configuration file is verified and verified before being released.
Optionally, the issuing means: storing the configuration file to a database, or storing the configuration file to the database and synchronizing the configuration file to a cache; the acquiring unit acquires a target configuration file corresponding to the target domain name, and includes:
judging whether a target configuration file corresponding to the target domain name exists in a cache or not; if yes, obtaining the target configuration file from a cache; otherwise, the target configuration file is obtained from the database.
Optionally, the target configuration file further includes: a version identification; the obtaining unit determines whether a target configuration file corresponding to the target domain name exists in a cache, including:
determining a target version identification corresponding to the target domain name according to a preset reverse proxy rule; judging whether a configuration file with the target domain name and the target version identification exists in a cache; if yes, judging that the target configuration file exists in the cache; otherwise, judging that the target configuration file does not exist in the cache.
Optionally, the reverse proxy system of the embodiment of the present invention further includes a configuration unit, configured to: responding to the configuration updating message, acquiring a configuration file from the database and storing the configuration file to a cache; or, the configuration file is obtained from the database through the timing task and is stored to the cache.
According to a third aspect of the embodiments of the present invention, there is provided a domain name reverse proxy system including: a domain name management system and a reverse proxy system; wherein the content of the first and second substances,
the domain name management system is configured to: generating and publishing a configuration file;
the reverse proxy system is configured to: according to the configuration file generated and issued by the domain name management system, the method provided by the first aspect of the embodiment of the invention is adopted to carry out reverse proxy.
According to a fourth aspect of the embodiments of the present invention, there is provided an electronic device of a reverse proxy, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method provided by the first aspect of the embodiments of the present invention.
According to a fifth aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method provided by the first aspect of embodiments of the present invention.
One embodiment of the above invention has the following advantages or benefits: according to the method and the device, the configuration file is automatically generated according to the domain name, the release address and the application resource of the application program, the problems that the online process is complex, errors are easy to occur and decoupling of application and domain name management cannot be realized due to the fact that the configuration file is manually generated and then packaged and uploaded to the server when the application program is online each time can be solved, one-key release of the configuration file is realized, unified management of the domain name can be realized, and statistics and monitoring are easy to realize. By caching the configuration file, the request response speed can be improved, the consumption of database resources is reduced, and the system stability is improved. The configuration file is managed through the version identifier, so that rollback is convenient to realize; by determining the target version identification according to the preset reverse proxy rule, the request can be directed to the configuration file of the latest version by modifying the preset reverse proxy rule when the version of the configuration file is changed, the automatic offline of the configuration file of the old version is realized, and the maintenance cost is reduced. The configuration file in the cache can be updated in time when the configuration file is generated or updated, the configuration file takes effect in real time under the condition of not restarting an application program, the configuration file is automatically on-line at regular time, and manual watching is not needed. By verifying the configuration file before the reverse proxy is carried out, the situation that the configuration file is failed to be issued due to the fact that the configuration file does not meet the set requirement can be avoided.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
fig. 1 is a schematic diagram of a main flow of a method of domain name management in an embodiment of the present invention;
FIG. 2 is a schematic diagram of the main flow of a reverse proxy method in an embodiment of the present invention;
FIG. 3 is a schematic diagram of the main components of a reverse proxy system in an embodiment of the present invention;
FIG. 4 is a schematic diagram of a domain name reverse proxy in an embodiment of the invention;
FIG. 5 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 6 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In the invention, a corresponding configuration file is generated in advance according to the domain name, the release address and the application resource of each application program. And when a user access request is received, performing reverse proxy according to a pre-generated configuration file. The reverse proxy is that a proxy end is used for receiving a connection request on the Internet and then forwarding the request to a background server end on an internal network; and the result obtained from the background server is returned to the client requesting connection on the Internet.
Before describing the reverse proxy method and system of the present invention, a method of generating a configuration file of the present invention will be described. Fig. 1 is a schematic diagram of a main flow of a domain name management method in an embodiment of the present invention, and as shown in fig. 1, the domain name management method includes:
step S101, resolving a domain name creating request, and determining a domain name, a release address and application resources of an application program;
step S102, generating a configuration file of a test state; the configuration file includes: domain name, publishing address and application resource;
and step S103, releasing the configuration file of the test state.
The application resource refers to various resources required by the page running of the application program, for example, when a domain name of a certain secondary channel of the application program is created, the various resources required by the page running of the secondary channel are the application resources. When an access party of an application program sends a domain name creating request, an application and a domain name are created, and a binding release address and a corresponding application resource are created. The invention creates the configuration file of the test state based on the domain name of the user, and the configuration file can be released after the test is passed.
Optionally, after generating the configuration file of the test state, the method further includes: and responding to a domain name issuing request, generating a configuration file of an on-line state according to the configuration file of the test state, and issuing the configuration file of the on-line state. Illustratively, after the configuration file in the test state passes the test, the access side of the application program sends a domain name publishing request for instructing to publish the configuration file in the test state on line.
The configuration file of the test state or the online state is automatically generated according to the domain name, the release address and the application resource of the application program, the problems that the online process is complex, errors are easy to occur and decoupling of application and domain name management cannot be realized due to the fact that the configuration file is manually generated and then packaged and uploaded to the server when the application program is online every time can be solved, one-key release of the configuration file is realized, unified management of the domain name can be realized, and statistics and monitoring are easy to realize.
When the configuration file is released, the released configuration file can be saved in a database, so that the reverse proxy system can acquire the released configuration file from the database. Optionally, the step of publishing the configuration file comprises: the configuration file is saved to a database and synchronized to the cache of the reverse proxy system. The reverse proxy system mentioned herein refers to the reverse proxy system provided in the first aspect of the embodiments of the present invention. The request response speed can be increased by caching the configuration file, the consumption of database resources is reduced, and the system stability is improved.
Optionally, the configuration file further includes: and identifying the version. Illustratively, for the channel a, a configuration file of the test state of the channel a is created for the first time, the version identifier of the configuration file is marked as V1.0, the configuration file of the test state of the V1.0 version can be modified for many times after being released, the version identifier is not changed when the modification is performed each time, the configuration file of the online state is released after the test is passed, and the configuration file of the online state is formed, wherein the version identifier of the configuration file of the online state is still V1.0. When the configuration information of the channel a needs to be reconfigured, the configuration file of the test state of the channel a can be created again, the version identifier of the configuration file is marked as V2.0, the configuration file of the test state of the V2.0 version can be modified for many times after being released, the version identifier is unchanged when the modification is performed each time, the configuration file of the online state is released after the test is passed, the configuration file of the online state is formed, and the version identifier of the configuration file of the online state is still V2.0. And by analogy, the channel A configuration information is created according to the steps each time the channel A configuration information needs to be reconfigured.
The configuration file is managed through the version identification, so that the configuration file with the target version identification can be conveniently searched, the version rollback can be realized, and the maintenance cost is reduced.
Optionally, synchronizing the configuration file to a cache of the reverse proxy system includes: and generating a configuration updating message, and sending the configuration updating message to the reverse proxy system so that the reverse proxy system responds to the configuration updating message to acquire a configuration file from the database and store the configuration file in the cache.
In the actual application process, after receiving the configuration update message, the reverse proxy system may immediately perform the step of obtaining the configuration file from the database, or periodically perform the step of obtaining the configuration file from the database through a timing task. The configuration updating message is generated after the configuration file is generated, so that the configuration file in the cache can be updated in time, the configuration file can be automatically validated in real time under the condition of not restarting an application program, the configuration file can be automatically on line at regular time, and manual watching is not needed.
Optionally, before the step of publishing the configuration file, the method further includes: and checking the generated configuration file and confirming that the check is passed. The content of the check can be selectively set according to the actual situation, for example, whether the syntax and format of the configuration file are correct or not can be checked. By checking the configuration file, the situation that the configuration file is failed to be issued due to the fact that the configuration file does not meet the set requirement can be avoided.
The domain name management method can be realized based on an upstream (a data forwarding mode in Nginx) mode in an openness (a Web platform based on Nginx and Lua) environment, and is realized by relying on Nginx (an HTTP and a reverse proxy Web server) and Lua (a script language). The domain name management is carried out based on the openness environment, so that the cost can be reduced.
The domain name management method can solve the following problems caused by manually generating the configuration file and then packaging and uploading the configuration file to the server when the application program is online in the prior art: in the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art, the configuration file is published by one key, the domain name can be uniformly managed, and the invention is easy to count and monitor: (1) the online process is complex and is easy to make mistakes; (2) the device cannot be automatically on-line at regular time and needs to be manually on duty; (3) no off-line operation is performed, and the later maintenance cost is high; (4) decoupling of applications from domain name management cannot be achieved.
According to a first aspect of embodiments of the present invention, a method of reverse proxy is provided.
Fig. 2 is a schematic diagram of a main flow of a reverse proxy method in the embodiment of the present invention. As shown in fig. 2, the reverse proxy method includes:
step S201, analyzing a target domain name corresponding to an application program to be accessed from an access request;
step S202, acquiring a target configuration file corresponding to the target domain name; the target configuration file comprises a domain name, a release address and an application resource of the application program to be accessed;
and step S203, reverse proxy is carried out based on the target configuration file.
It should be noted that the target configuration file may be a configuration file of a test state generated and issued in response to the domain name creation request in advance, for example, after the target domain name is determined in response to the user access request in the test environment, a configuration file corresponding to the target domain name is screened from configuration files of various test states as the target configuration file. The target configuration file in the present invention may also be a configuration file of an online state that is generated and issued according to a configuration file of a test state in response to a domain name issuing request in advance, for example, after a target domain name is determined in response to a subsequent access request in a production environment, a configuration file corresponding to the target domain name is screened from configuration files of online states as a target configuration file.
Optionally, the configuration file is verified and verified before being released. The content of the check can be selectively set according to the actual situation, for example, whether the syntax and format of the configuration file are correct or not can be checked. By checking the configuration file, the situation that the configuration file is failed to be issued due to the fact that the configuration file does not meet the set requirement can be avoided.
The configuration file issued based on the domain name management method is subjected to reverse proxy, the problems that the online process is complex, errors are easy to occur and decoupling of application and domain name management cannot be realized due to the fact that the configuration file is manually generated and then packaged and uploaded to a server when an application program is online every time can be solved, one-key issuing of the configuration file is realized, unified management of the domain name can be realized, and statistics and monitoring are easy to realize.
Optionally, publishing means: and storing the configuration file to a database, or storing the configuration file to the database and synchronizing the configuration file to a cache. In the actual application process, the published configuration file can be directly obtained from the database. Optionally, the obtaining of the target configuration file corresponding to the target domain name includes: judging whether a target configuration file corresponding to the target domain name exists in a cache or not; if yes, obtaining the target configuration file from a cache; otherwise, the target configuration file is obtained from the database.
The cache may include a cache of the pre-launch and a cache of the production environment reverse proxy system. The reverse proxy system refers to a system for performing reverse proxy by using the reverse proxy method provided by the first aspect of the present invention based on a pre-published configuration file, and may include a pre-transmitter and a production environment reverse proxy system. The pre-issuing machine is a testing machine and is used for previewing the issuing effect of the configuration file in the testing state. And the production environment reverse agent system carries out reverse agent based on the configuration file which is released to be on-line, so that the configuration file in the on-line state formally takes effect.
Exemplarily, under a test environment, judging whether a target configuration file corresponding to the target domain name exists in a cache of a pre-transmitter; if yes, obtaining the target configuration file from a cache of a pre-transmitter; otherwise, the target configuration file is obtained from the database. Under the production environment, judging whether a target configuration file corresponding to the target domain name exists in a cache of a reverse proxy system of the production environment; if yes, obtaining the target configuration file from a cache of a reverse proxy system of the production environment; otherwise, the target configuration file is obtained from the database.
The request response speed can be increased by caching the configuration file, the consumption of database resources is reduced, and the system stability is improved.
Optionally, the target configuration file further includes: a version identification; judging whether a target configuration file corresponding to the target domain name exists in the cache or not, wherein the judging step comprises the following steps: determining a target version identification corresponding to the target domain name according to a preset reverse proxy rule; judging whether a configuration file with the target domain name and the target version identification exists in a cache; if yes, judging that the target configuration file exists in the cache; otherwise, judging that the target configuration file does not exist in the cache.
The pre-set reverse proxy rule is used to indicate an available profile corresponding to a user access request. For example, each time a new version of the profile is released, a user access request is automatically directed to the most recent version of the profile corresponding to the target domain name. When a user access request is received, a target domain name corresponding to an application program to be accessed is analyzed from the access request, then a configuration file with the latest version of the target domain name is obtained, reverse proxy is carried out based on the obtained configuration file with the latest version, so that the request can be directed to the configuration file with the latest version by modifying a preset reverse proxy rule when the version of the configuration file is changed, automatic offline of the configuration file with the old version is realized, and maintenance cost is reduced.
The configuration file of the online state is managed through the version identifier, and the target version identifier is determined according to the preset reverse proxy rule, so that the configuration file with the target version identifier is conveniently searched, the version rollback is realized, and the maintenance cost is reduced. On the other hand, when the version of the configuration file is changed, the preset reverse proxy rule is modified to enable the request to point to the configuration file of the latest version, so that automatic offline of the configuration file of the old version is realized, and the maintenance cost is reduced.
Optionally, the method for domain name management in the embodiment of the present invention is further characterized in that: responding to the configuration updating message, acquiring a configuration file from the database and storing the configuration file to a cache; or, the configuration file is obtained from the database through the timing task and is stored to the cache.
The configuration file in the cache can be updated in time by responding to the configuration updating message or executing the timing task to acquire the configuration file from the database and store the configuration file in the cache, the configuration file can be automatically validated in real time under the condition of not restarting an application program, the configuration file can be automatically on-line at regular time, and manual watching is not needed.
The reverse proxy method of the embodiment of the invention can be realized based on an upstream (a data forwarding mode in Nginx) mode in an openness (a Web platform based on Nginx and Lua) environment, and is realized by relying on Nginx (an HTTP and a reverse proxy Web server) and Lua (a script language). And reverse proxy is carried out based on the openness environment, so that the cost can be reduced.
According to a second aspect of the embodiments of the present invention, there is provided a system for implementing the method provided by the first aspect of the embodiments of the present invention.
Fig. 3 is a schematic diagram of the main components of the reverse proxy system in the embodiment of the present invention. As shown in fig. 3, the reverse proxy system 300 includes:
the analysis unit 301 is used for analyzing a target domain name corresponding to the application program to be accessed from the access request;
an obtaining unit 302, configured to obtain a target configuration file corresponding to the target domain name; the target configuration file comprises a domain name, a release address and an application resource of the application program to be accessed;
the proxy unit 303 performs reverse proxy based on the target profile.
Optionally, the target configuration file is a configuration file of a test state generated and issued in response to a domain name creation request in advance, or a configuration file of an online state generated and issued in response to a domain name issue request in advance according to the configuration file of the test state.
Optionally, the configuration file is verified and verified before being released.
Optionally, the issuing means: storing the configuration file to a database, or storing the configuration file to the database and synchronizing the configuration file to a cache; the acquiring unit acquires a target configuration file corresponding to the target domain name, and includes:
judging whether a target configuration file corresponding to the target domain name exists in a cache or not; if yes, obtaining the target configuration file from a cache; otherwise, the target configuration file is obtained from the database.
Optionally, the target configuration file further includes: a version identification; the obtaining unit determines whether a target configuration file corresponding to the target domain name exists in a cache, including:
determining a target version identification corresponding to the target domain name according to a preset reverse proxy rule; judging whether a configuration file with the target domain name and the target version identification exists in a cache; if yes, judging that the target configuration file exists in the cache; otherwise, judging that the target configuration file does not exist in the cache.
Optionally, the reverse proxy system of the embodiment of the present invention further includes a configuration unit, configured to: responding to the configuration updating message, acquiring a configuration file from the database and storing the configuration file to a cache; or, the configuration file is obtained from the database through the timing task and is stored to the cache.
The reverse proxy system of the embodiment of the present invention may set a plurality of Application Programming Interfaces (APIs) to facilitate management of the cache in the reverse proxy system and preset reverse proxy rules through the API interfaces. For example, the production environment is manipulated to configure the cache, monitor the health status of each server, obtain statistical data, and the like.
According to a third aspect of the embodiments of the present invention, there is provided a domain name reverse proxy system including: a domain name management system (a system for implementing the domain name management method according to the embodiment of the present invention) and a reverse proxy system (a system for implementing the reverse proxy according to the embodiment of the present invention). The domain name management system is configured to generate and issue a configuration file, and the reverse proxy system is configured to perform reverse proxy by using the reverse proxy method provided in the first aspect of the embodiment of the present invention according to the configuration file generated and issued by the domain name management system.
Fig. 4 is a schematic diagram of a domain name reverse-proxy system 400 in an embodiment of the present invention, and as shown in fig. 4, the domain name management system 200 is configured to: analyzing the domain name creating request, and determining the domain name, the release address and the application resource of the application program; generating a configuration file of a test state; the configuration file includes: domain name, publishing address and application resource; issuing a configuration file of the test state;
the reverse proxy system 300 is configured to: analyzing a target domain name corresponding to the application program to be accessed from the access request; acquiring a target configuration file corresponding to the target domain name; reverse proxying is performed based on the target profile.
In fig. 4, 401 represents a database for storing a configuration file issued by the domain name management system 200. The domain name management system 200 and the reverse proxy system 300 are described in detail in the foregoing, and will not be described in detail herein.
It should be noted that, in this example, reverse proxy system 300 may set a plurality of API interfaces, so that domain name management system 200 manages the cache and preset reverse proxy rules in the reverse proxy system through the API interfaces. For example, the production environment is manipulated to configure the cache, monitor the health status of each server, obtain statistical data, and the like.
According to a fourth aspect of the embodiments of the present invention, there is provided an electronic device of a reverse proxy, including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method provided by the first aspect of the embodiments of the present invention.
According to a fifth aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method provided by the first aspect of embodiments of the present invention.
Fig. 5 illustrates an exemplary system architecture 500 of a reverse-proxy method or system to which embodiments of the invention may be applied.
As shown in fig. 5, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 serves to provide a medium for communication links between the terminal devices 501, 502, 503 and the server 505. Network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 501, 502, 503 to interact with a server 505 over a network 504 to receive or send messages or the like. The terminal devices 501, 502, 503 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 501, 502, 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 505 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 501, 502, 503. The background management server may analyze and perform other processing on the received data such as the domain name urban construction request and the user access request, and feed back a processing result (for example, information indicating whether the domain name is successfully created, and information of a page to be accessed — just an example) to the terminal device.
It should be noted that the reverse proxy method provided by the embodiment of the present invention is generally executed by the server 505, and accordingly, a reverse proxy system or a reverse proxy system is generally disposed in the server 505.
It should be understood that the number of terminal devices, networks, and servers in fig. 5 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use with a terminal device implementing an embodiment of the invention is shown. The terminal device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present invention may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor comprising: the analysis unit is used for analyzing the target domain name corresponding to the application program to be accessed from the access request; the acquisition unit is used for acquiring a target configuration file corresponding to the target domain name; the target configuration file comprises a domain name, a release address and an application resource of the application program to be accessed; and the proxy unit performs reverse proxy based on the target configuration file. Where the names of these units do not in some cases constitute a limitation of the unit itself, for example, a parsing unit may also be described as a "reverse-proxying unit based on the target profile".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:
analyzing a target domain name corresponding to the application program to be accessed from the access request; acquiring a target configuration file corresponding to the target domain name; the target configuration file comprises a domain name, a release address and an application resource of the application program to be accessed; reverse proxying is performed based on the target profile.
According to the technical scheme of the embodiment of the invention, the configuration file is automatically generated according to the domain name, the release address and the application resource of the application program, so that the problems of complex online process, easy error and incapability of realizing decoupling of application and domain name management caused by manually generating the configuration file and packaging and uploading the configuration file to the server when the application program is online every time can be solved, the configuration file is released by one key, and meanwhile, unified management of the domain name can be realized, and statistics and monitoring are easy. By caching the configuration file, the request response speed can be improved, the consumption of database resources is reduced, and the system stability is improved. The configuration file is managed through the version identifier, so that rollback is convenient to realize; by determining the target version identification according to the preset reverse proxy rule, the request can be directed to the configuration file of the latest version by modifying the preset reverse proxy rule when the version of the configuration file is changed, the automatic offline of the configuration file of the old version is realized, and the maintenance cost is reduced. The configuration file in the cache can be updated in time when the configuration file is generated or updated, the configuration file takes effect in real time under the condition of not restarting an application program, the configuration file is automatically on-line at regular time, and manual watching is not needed. By verifying the configuration file before the reverse proxy is carried out, the situation that the configuration file is failed to be issued due to the fact that the configuration file does not meet the set requirement can be avoided.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method of reverse proxying, comprising:
analyzing a target domain name corresponding to the application program to be accessed from the access request;
acquiring a target configuration file corresponding to the target domain name; the target configuration file comprises a domain name, a release address and an application resource of the application program to be accessed;
reverse proxying is performed based on the target profile.
2. The method according to claim 1, wherein the target profile is a profile of a test status generated and issued in response to a domain name creation request in advance, or a profile of an on-line status generated and issued in response to a domain name issuance request in advance in accordance with the profile of the test status.
3. The method of claim 2, wherein the configuration file is verified and validated prior to publication.
4. The method of claim 3, wherein the publishing refers to: storing the configuration file to a database, or storing the configuration file to the database and synchronizing the configuration file to a cache; acquiring a target configuration file corresponding to the target domain name, wherein the acquiring comprises the following steps:
judging whether a target configuration file corresponding to the target domain name exists in a cache or not; if yes, obtaining the target configuration file from a cache; otherwise, the target configuration file is obtained from the database.
5. The method of claim 4, wherein the target profile further comprises: a version identification; judging whether a target configuration file corresponding to the target domain name exists in the cache or not, wherein the judging step comprises the following steps:
determining a target version identification corresponding to the target domain name according to a preset reverse proxy rule; judging whether a configuration file with the target domain name and the target version identification exists in a cache; if yes, judging that the target configuration file exists in the cache; otherwise, judging that the target configuration file does not exist in the cache.
6. The method of claim 4, further comprising: responding to the configuration updating message, acquiring a configuration file from the database and storing the configuration file to a cache; or, the configuration file is obtained from the database through the timing task and is stored to the cache.
7. A reverse proxy system, comprising:
the analysis unit is used for analyzing the target domain name corresponding to the application program to be accessed from the access request;
the acquisition unit is used for acquiring a target configuration file corresponding to the target domain name; the target configuration file comprises a domain name, a release address and an application resource of the application program to be accessed;
and the proxy unit performs reverse proxy based on the target configuration file.
8. A domain name reverse proxy system, comprising: a domain name management system and a reverse proxy system; wherein the content of the first and second substances,
the domain name management system is configured to: generating and publishing a configuration file;
the reverse proxy system is configured to: performing reverse proxy by using the method of any one of claims 1 to 6 according to the configuration file generated and issued by the domain name management system.
9. An electronic device of a reverse proxy, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN202010041946.8A 2020-01-15 2020-01-15 Reverse proxy method and system Pending CN113132447A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010041946.8A CN113132447A (en) 2020-01-15 2020-01-15 Reverse proxy method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010041946.8A CN113132447A (en) 2020-01-15 2020-01-15 Reverse proxy method and system

Publications (1)

Publication Number Publication Date
CN113132447A true CN113132447A (en) 2021-07-16

Family

ID=76771419

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010041946.8A Pending CN113132447A (en) 2020-01-15 2020-01-15 Reverse proxy method and system

Country Status (1)

Country Link
CN (1) CN113132447A (en)

Similar Documents

Publication Publication Date Title
US9590859B2 (en) Discovering resources of a distributed computing environment
CN111427701A (en) Workflow engine system and business processing method
CN107766509B (en) Method and device for static backup of webpage
CN109829121B (en) Method and device for reporting click behavior data
CN110851471A (en) Distributed log data processing method, device and system
CN112748962A (en) Application loading method and device, electronic equipment and computer readable medium
CN112468511A (en) File transmission method and device
CN113132447A (en) Reverse proxy method and system
CN112131095A (en) Pressure testing method and device
CN110851194A (en) Method and device for acquiring code for realizing new interface
CN109889402B (en) Method and apparatus for generating information
CN108984189B (en) Module parsing method and device
CN110019030B (en) Method and device for dividing file
US10079739B2 (en) Computer-implemented method for handling log file
CN111949472A (en) Method and device for recording application logs
CN113760699A (en) Server performance test system and method
CN112860268A (en) Template hot deployment method and device
CN113760635A (en) Method and device for determining connection abnormity, electronic equipment and storage medium
CN112579447A (en) Browser testing method and device
CN113760564A (en) Data processing method, device and system
CN113704080A (en) Automatic testing method and device
CN113220558A (en) Monitoring script generation method and device, and monitoring method and device
CN112948138A (en) Method and device for processing message
CN112559001A (en) Method and device for updating application
CN112448931A (en) Network hijacking monitoring method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination