Request processing method, device and program product

By receiving and processing requests carrying backend environment information in the Nginx server, dynamically determining the target domain name and forwarding the request, the cumbersome problem of manually setting backend environment information in the Nginx configuration file is solved, and efficient backend environment switching is achieved.

CN119814655APending Publication Date: 2025-04-11KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411793780.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In the configuration file of the Nginx server, you need to manually set the service domain name and other related information of the backend environment, which leads to manual modification of the configuration file when the backend environment changes, which is cumbersome and inefficient.

Method used

By receiving the target request sent by the user, the request carries the environment information of the target backend environment, extracts the environment information and determines the target domain name corresponding to the environment information from the preset multiple domain names, thereby obtaining the target forwarding address corresponding to the target domain name, and sending the request to the corresponding backend server.

Benefits of technology

The dynamic routing of Nginx server is realized, and users can flexibly change the backend environment without modifying the Nginx configuration file, which significantly improves the efficiency and convenience of backend environment switching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119814655A_ABST
    Figure CN119814655A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a request processing method and device and a program product. The method comprises the steps that a target request sent by a user side is received; wherein the target request carries environment information of a target back-end environment, extracting the environment information carried by the target request, and determining a target domain name corresponding to the environment information from a plurality of preset domain names; and obtaining a target forwarding address corresponding to the target domain name, so as to send the target request to a back-end server corresponding to the target forwarding address. According to the embodiment of the invention, the user is allowed to flexibly change the required back-end environment without modifying the Nginx configuration file, the environment change efficiency is improved, and the dynamic routing of the request is efficiently and conveniently realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a request processing method, device, and program product. Background Art

[0002] In order to reduce the cost of service resources and other factors, Nginx server can be used to provide services such as static resource services and backend service forwarding to the user end. However, the inventor found through research that it is usually necessary to set the service domain name and other related information of the backend environment in the configuration file of the Nginx server, that is, the backend environment is fixed and unchanged. The Nginx server needs to forward the request to be processed by the backend sent by the user end to the Nginx server to the backend server corresponding to the backend environment based on the configuration file. However, in actual applications, there is often a need to change the backend environment, and each change requires manual modification of the Nginx configuration file, which is cumbersome and inconvenient, and inefficient. Summary of the invention

[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a request processing method, device and program product.

[0004] The disclosed embodiment provides a request processing method, which is applied to an Nginx server, and includes: receiving a target request sent by a user terminal; wherein the target request carries environmental information of a target backend environment; extracting the environmental information carried by the target request, and determining a target domain name corresponding to the environmental information from a plurality of preset domain names; obtaining a target forwarding address corresponding to the target domain name, so as to send the target request to a backend server corresponding to the target forwarding address.

[0005] Optionally, the environmental information is information received by the user terminal through a preset control panel; and the environmental information is stored by the user terminal in the environment field of the target file; wherein the target file has a binding relationship with the domain name corresponding to the Nginx server, and the binding relationship is used to indicate that the target request sent by the user terminal to the Nginx server carries the field information of the target file.

[0006] Optionally, a target control is provided on the preset control panel, and the target control is used to display the current backend environment information of the user terminal, and the target control is also used to receive the environment information of the target backend environment to be switched.

[0007] Optionally, extracting the environmental information carried by the target request and determining the target domain name corresponding to the environmental information from a preset plurality of domain names includes: calling a target script based on an Nginx configuration file to extract the environmental information carried by the target request through the target script, and determining the target domain name corresponding to the environmental information from a preset plurality of domain names.

[0008] Optionally, extracting the environment information carried by the target request includes: identifying an environment field from field information of the target file carried by a Hypertext Transfer Protocol request header of the target request; and extracting the environment information based on the environment field.

[0009] Optionally, determining the target domain name corresponding to the environmental information from a preset plurality of domain names includes: reading a preset domain name list in an Nginx configuration file, and determining the target domain name corresponding to the environmental information from the domain name list based on a preset strategy; wherein the preset strategy is used to indicate a mapping relationship between the plurality of domain names in the domain name list and the preset plurality of environmental information.

[0010] Optionally, obtaining the target forwarding address corresponding to the target domain name includes: sending the target domain name to the domain name system resolution server based on the address of the domain name system resolution server predefined in the Nginx configuration file; and determining the target forwarding address corresponding to the target domain name through the domain name system resolution server.

[0011] Optionally, the environment information is attached to a Hypertext Transfer Protocol request header of the target request.

[0012] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the request processing method provided by the embodiment of the present disclosure.

[0013] The embodiments of the present disclosure also provide a computer program product, including a computer program, which implements the request processing method provided in the embodiments of the present disclosure when executed by a processor.

[0014] In the above technical solution provided by the embodiment of the present disclosure, the target request of the user end received by the Nginx server directly carries the environment information of the target backend environment. The Nginx server can determine the target domain name corresponding to the environment information from the preset multiple domain names, thereby obtaining the target forwarding address corresponding to the target domain name, and sending the target request to the backend server corresponding to the target forwarding address. The above method no longer fixes the relevant information of the backend environment in the Nginx configuration file. The Nginx server can realize dynamic routing based on the environment information of the target backend environment carried by the target request, allowing the user to flexibly change the required backend environment without modifying the Nginx configuration file, which greatly improves the efficiency and convenience of backend environment switching.

[0015] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0018] Figure 1 A flowchart of a request processing method provided by an embodiment of the present disclosure;

[0019] Figure 2 A schematic diagram of an interface of a control panel provided in an embodiment of the present disclosure;

[0020] Figure 3 A schematic diagram of a request processing flow provided by an embodiment of the present disclosure;

[0021] Figure 4 A schematic diagram of the structure of a request processing device provided in an embodiment of the present disclosure;

[0022] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0023] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0024] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0025] The cost required for implementing web page static resource service and backend service forwarding through Node.js is relatively high. In order to reduce the cost, the Nginx server can be used to provide services such as static resource service and backend service forwarding for the user end. Among them, the Nginx server is a high-performance reverse proxy server that can provide static resource service and forward the client's request to the backend server. It has many advantages such as high concurrent connection, low resource consumption, load balancing, strong stability, strong security, and easy deployment. However, the Nginx server needs to rely on the service domain name and other related information of the backend environment recorded in the Nginx configuration file to forward the request, and the information in the Nginx configuration file needs to be manually set. If the backend environment needs to be changed, that is, if the backend service domain name needs to be modified, the service proxy address needs to be switched accordingly, then the Nginx configuration file needs to be manually modified, and then submitted, compiled and deployed. This series of links is relatively cumbersome and inconvenient, time-consuming and inefficient. In order to improve the above problems, the present disclosure embodiment provides a request processing method, device and program product, which are described in detail below.

[0026] Figure 1 A flowchart of a request processing method provided in an embodiment of the present disclosure is provided. The method can be executed by a request processing device, wherein the device can be implemented using software and / or hardware and can generally be integrated in an electronic device, such as an Nginx server.

[0027] like Figure 1 As shown, the method mainly includes the following steps S102 to S106:

[0028] Step S102, receiving a target request sent by the user; wherein the target request carries the environment information of the target backend environment. The disclosed embodiment does not specifically limit the target request, and any request that needs to be processed by the backend server or the request to be forwarded to the backend server by the Nginx server can be used as the target request, such as a page data request initiated when the user refreshes the page.

[0029] The backend environment may also be referred to as a proxy environment, including but not limited to a development environment, a test environment, a production environment, etc. In the disclosed embodiment, the target request additionally carries the environment information of the target backend environment, which is the backend environment that the user expects to run. The environment information may include an environment identifier, and different backend environments have different environment identifiers. The environment identifier can clearly indicate the target backend environment that the user expects. In actual applications, the environment information of the target backend environment can be set by the user through an interactive interface such as a control panel. For example, the user can set the environment identifier of the desired backend environment, and the target request sent by the user end to the Nginx server can automatically carry the environment identifier.

[0030] Step S104: extract the environment information carried in the target request, and determine the target domain name corresponding to the environment information from a plurality of preset domain names.

[0031] The Nginx server can extract the environment information carried by the target request, such as extracting the environment identifier of the target backend environment carried in the target request, and determining the corresponding target domain name based on the environment identifier. It should be noted that the Nginx server in the embodiment of the present disclosure no longer needs to rely on the Nginx configuration file, such as after receiving the user-side request, it no longer needs to search for relevant information about the backend environment from the Nginx configuration file, but directly determines the corresponding target domain name dynamically based on the environment information carried by the target request to achieve dynamic routing of the request.

[0032] Step S106, obtaining a target forwarding address corresponding to the target domain name, so as to send the target request to a backend server corresponding to the target forwarding address.

[0033] A domain name is a string of characters separated by periods. It is an identifier for locating network devices during data transmission. It is highly readable and easy to remember. In practical applications, domain names and IP addresses have a mapping relationship. IP addresses are unique digital identifiers of network devices. The embodiments of the present disclosure can convert domain names that are easy to remember into IP addresses that can be recognized by computers. The above-mentioned target forwarding address is also the IP address corresponding to the target domain name, thereby accurately locating the backend server and realizing reliable routing of requests.

[0034] In summary, the above-mentioned request processing method provided by the embodiment of the present disclosure no longer fixes the relevant information of the backend environment in the Nginx configuration file. The Nginx server can implement dynamic routing based on the environmental information of the target backend environment carried by the target request, allowing users to flexibly change the required backend environment without modifying the Nginx configuration file, greatly improving the efficiency and convenience of backend environment switching.

[0035] In some implementation examples, environmental information is attached to a Hypertext Transfer Protocol (HTTP) request header of a target request, wherein the Hypertext Transfer Protocol request header may be referred to as an HTTP request header hereinafter, and the HTTP request header is part of an HTTP request message, and may include additional information sent by a client to a server so that the server can better process the request. The disclosed embodiment attaches environmental information (such as an environment identifier) ​​to an HTTP request header, making it easier for an Nginx server to parse the target request, thereby accurately knowing the target backend environment corresponding to the target request.

[0036] In order to facilitate users to change the required backend environment flexibly and conveniently, in some embodiments, the environmental information is the information received by the user end through a preset control panel. In other words, a preset control panel can be presented to the user on the user end, and a target control is set on the preset control panel. The target control is used to display the current backend environmental information of the user end, and the target control is also used to receive the environmental information of the target backend environment to be switched. The above target control can be presented on the preset control panel in the form of a trigger control. In specific implementation, a trigger control (that is, the aforementioned target control) for changing the backend environment is presented on the preset control panel. In response to the trigger control being triggered, the current backend environment identifier of the user end can be displayed to the user, and the currently optional backend environment identifier can be provided, or an input box for the backend environment identifier can be provided to the user for the user to set the required environment identifier by himself. The disclosed embodiment does not limit the implementation method of the control panel. In some specific examples, Eruda (a developer tool designed for mobile browsers) can be integrated on the front-end page, and Eruda can be used to create and display a control panel for switching different backend environments.

[0037] For ease of understanding, please refer to Figure 2 The interface diagram of a control panel shown indicates that there can be multiple trigger controls on the control panel for modifying information, such as network controls, resource controls, environment controls, etc., which can be flexibly set. It also shows that when the environment control is triggered, the current environment (development environment 1) can be presented, and a prompt "You can choose to switch to development environment 2, development environment 3, test environment 1, etc." can be initiated. If the user further triggers the environment switch, the user can also be presented with "Please enter the environment you want to switch to", and the user can also enter the environment you want to switch to (such as test environment 2) as needed. Through the above-mentioned intuitive control panel, users can flexibly and conveniently set the required backend environment without having to change the Nginx configuration file, that is, there is no need to perform more complicated code modification, compilation and deployment. Switching the environment directly through the above-mentioned control panel can flexibly adapt to the testing or demonstration needs in different scenarios. It should be noted that Figure 2This is only a brief illustration of the control panel and should not be considered as a limitation. In actual applications, the interface and functions of the control panel can be flexibly set.

[0038] After the user terminal receives the environment information of the target backend environment through the preset control panel, the environment information is stored by the user terminal in the environment field in the target file. Taking the environment information including the environment identifier as an example, the user terminal can store the environment identifier as the value of the environment field in the target file. In some specific examples, the target file can be a Cookie file. It can be understood that Cookie is a small text file, which can also be specifically called a browser Cookie. The user terminal can save information through the Cookie file. The embodiment of the present disclosure refers to the Cookie file storing the environment field as the target file. When the user selects a new backend environment through the preset control panel, the user terminal can immediately save the environment information of the target backend environment set by the user to the environment field in the target file through JavaScript code and other methods, and can bind it to the currently accessed domain name (that is, the domain name corresponding to the Nginx server). In other words, the target file has a binding relationship with the domain name corresponding to the Nginx server, and the binding relationship is used to indicate that the target request sent by the user terminal to the Nginx server carries the field information of the target file. In this way, it can be ensured that when the user sends a target request to the Nginx server, the target request can automatically carry the information in the target file. Specifically, when the user initiates a target request (such as refreshing the page), the browser can automatically attach all the field information contained in the target file to the HTTP request header, so that the target request carries the environment information of the target backend environment. In this way, user personalized settings can be guaranteed, the machines and browser environments of different users are independent, and the Cookie settings of different users do not affect each other, thus achieving the isolation of environment settings; for each user, the information in his Cookie file will be automatically carried when sending a target request, and the persistence of the environment settings can also be maintained. After the user changes the backend environment, the environment information of the backend environment in the Cookie file will also change accordingly.

[0039] In the disclosed embodiment, when the Nginx server executes the steps of extracting the environmental information carried by the target request and determining the target domain name corresponding to the environmental information from the preset multiple domain names, the target script can be called based on the Nginx configuration file to extract the environmental information carried by the target request through the target script, and determine the target domain name corresponding to the environmental information from the preset multiple domain names. Specifically, a specific instruction can be set in the Nginx configuration file, which is used to instruct the Nginx server to call the target script before processing the target request, and extract the environmental information carried by the target request through the target script, and determine the target domain name corresponding to the environmental information from the preset multiple domain names. Among them, the target script can be a Lua script, which is a lightweight, scalable embedded scripting language that is more convenient to introduce into the Nginx configuration file and call flexibly. The above is only an example. In actual applications, the target script can also be implemented in other languages, which is not limited here. Dynamic routing can be realized based on the request content through the target script. In actual applications, the environment can be dynamically changed according to the request by setting the target script, and it is more flexible and convenient.

[0040] As mentioned above, the embodiment of the present disclosure can carry all the fields of the target file in the HTTP request header of the target request. On this basis, when extracting the environment information carried by the target request, the environment field can be identified from the field information of the target file carried by the HTTP request header of the target request, and the environment information can be extracted based on the environment field. Specifically, when executing the target script (taking Lua script as an example), the value of the environment field can be extracted from the target file based on the regular expression function of Lua, that is, the environment information of the target backend environment, which can specifically be the environment identifier of the target backend environment.

[0041] In some embodiments, determining a target domain name corresponding to the environmental information from a plurality of preset domain names includes: reading a preset domain name list in an Nginx configuration file, and determining a target domain name corresponding to the environmental information from the domain name list based on a preset strategy; wherein the preset strategy is used to indicate a mapping relationship between a plurality of domain names in the domain name list and a plurality of preset environmental information. Specifically, the target script can read a domain name list from the Nginx configuration file, and then determine a target domain name having a mapping relationship with the environmental identifier based on the acquired environmental identifier and a plurality of domain names in the domain name list, and the mapping relationship can be preset, such as the mapping relationship can be related to the business, which is not limited here. It can be understood that in the related art, the domain name of the backend environment and other related information are fixedly set in the Nginx configuration file, while in the embodiment of the present disclosure, the domain name is used as a variable, and the target domain name needs to be dynamically determined based on the environmental information carried by the request, so as to realize flexible forwarding of the request.

[0042] After determining the target domain name, the target forwarding address corresponding to the target domain name can be obtained. Specifically, the target domain name can be sent to the domain name system resolution server based on the address of the domain name system resolution server predefined in the Nginx configuration file; the target forwarding address corresponding to the target domain name is determined by the domain name system resolution server. The domain name system (DNS) is a distributed database system that organizes, manages and allocates the correspondence between domain names and IP addresses in the Internet. The main function of the domain name system is to convert easy-to-remember domain names into IP addresses that can be recognized by computers, thereby achieving access to Internet resources. The disclosed embodiment can pre-define the address of the domain name system resolution server in the Nginx configuration file so that the internal or external domain name can be correctly resolved by the domain name system resolution server, so as to accurately know the target forwarding address corresponding to the target domain name with the help of the domain name system resolution server. The target forwarding address is also the IP address of the back-end server corresponding to the target back-end environment. In this way, the target request can be accurately routed to the back-end server required by the user.

[0043] In summary, for easier understanding, you can also refer to Figure 3 The request processing flow diagram shown mainly illustrates the interaction between the user end, the Nginx server, the DNS resolution server and the back-end server, wherein the DNS resolution server is the abbreviation of the above-mentioned domain name system resolution server. Figure 3 Specifically include the following steps:

[0044] Step S302: The user terminal receives the environment information of the target backend environment through a preset control panel, and stores the environment information in the environment field of the Cookie file.

[0045] Step S304: in response to receiving the target request, the client appends the field information of the Cookie file to the HTTP request header of the target request.

[0046] Step S306: The client sends the target request to the Nginx server.

[0047] Step S308, the Nginx server identifies the environment field from the field information of the Cookie file carried by the HTTP request header of the target request, extracts the environment information based on the environment field, reads the domain name list preset in the Nginx configuration file, and determines the target domain name corresponding to the environment information from the domain name list based on the preset strategy.

[0048] In actual applications, a specific instruction may be set in the configuration file of the Nginx server, and the target script is called through the instruction, and the above step S308 is performed with the help of the target script.

[0049] Step S310, the Nginx server sends the target domain name to the DNS resolution server based on the address of the DNS resolution server predefined in the Nginx configuration file.

[0050] Step S312: The DNS resolution server determines a target forwarding address corresponding to the target domain name.

[0051] Step S314, the DNS resolution server sends the target request to the back-end server corresponding to the target forwarding address.

[0052] The specific implementation methods of the above steps can refer to the aforementioned related contents, which will not be repeated here. The above method provided by the embodiment of the present disclosure no longer sets the relevant information of the backend environment in a fixed manner in the Nginx configuration file. Users can customize the required backend environment according to personal needs. Specifically, the required backend environment can be flexibly changed directly at the front-end control panel, without wasting time and energy to adjust the Nginx configuration file. Each time the backend environment is changed, a series of links such as manual modification of the configuration file, submission, compilation and deployment can be omitted, which can effectively reduce time consumption. Except for the user setting the environment identifier of the required backend environment on the intuitive control panel, the rest of the processing flow is basically transparent and imperceptible to the user, and the user experience is high. The above method provided by the embodiment of the present disclosure can enable the Nginx server to implement dynamic routing based on the environmental information of the target backend environment carried by the target request, greatly improving the efficiency and convenience of backend environment switching, and optimizing processes such as publishing. Furthermore, the above method gives each developer a high degree of flexibility, allowing developers to customize the configuration environment according to their personal development needs without having to deploy a differentiated environment for each developer separately. Developers can also flexibly set the mapping strategy between domain names and environments according to their needs. Even the same basic environment can dynamically configure the mapping strategy according to individual actual needs, pointing to the target backend environment required by each developer, which helps to achieve efficient reuse of resources and accurate satisfaction of personalized needs. It can not only improve the overall work efficiency of the development team, but also promote the standardization and normalization of the development process.

[0053] Corresponding to the aforementioned request processing method, the embodiment of the present disclosure further provides a request processing device, Figure 4 The structure diagram of a request processing device provided by an embodiment of the present disclosure is shown in FIG. 1 . The device can be implemented by software and / or hardware and can generally be integrated in an electronic device, which can be an Nginx server. Figure 4 As shown, the request processing device includes:

[0054] The request receiving module 402 is used to receive a target request sent by a user end; wherein the target request carries the environment information of the target backend environment;

[0055] A domain name determination module 404 is used to extract the environment information carried in the target request and determine a target domain name corresponding to the environment information from a plurality of preset domain names;

[0056] The request sending module 406 is used to obtain a target forwarding address corresponding to the target domain name, so as to send the target request to a backend server corresponding to the target forwarding address.

[0057] The request processing device provided by the embodiment of the present disclosure no longer fixes the relevant information of the backend environment in the Nginx configuration file. The Nginx server can implement dynamic routing based on the environmental information of the target backend environment carried by the target request, allowing the user to flexibly change the required backend environment without modifying the Nginx configuration file, greatly improving the efficiency and convenience of backend environment switching.

[0058] In some implementations, the environment information is appended to a Hypertext Transfer Protocol request header of the target request.

[0059] In some embodiments, the environment information is information received by the user terminal through a preset control panel; and the environment information is stored by the user terminal in an environment field of the target file;

[0060] In some implementations, the target file has a binding relationship with a domain name corresponding to the Nginx server, and the binding relationship is used to indicate that the target request sent by the client to the Nginx server carries field information of the target file.

[0061] In some implementations, a target control is provided on the preset control panel, and the target control is used to display the current backend environment information of the user terminal, and the target control is also used to receive the environment information of the target backend environment to be switched.

[0062] In some embodiments, the domain name determination module 404 is specifically used to: call the target script based on the Nginx configuration file to extract the environment information carried by the target request through the target script, and determine the target domain name corresponding to the environment information from multiple preset domain names.

[0063] In some implementations, the domain name determination module 404 is specifically configured to: identify an environment field from field information of a target file carried in a hypertext transfer protocol request header of the target request; and extract environment information based on the environment field.

[0064] In some embodiments, the domain name determination module 404 is specifically used to: read a domain name list preset in the Nginx configuration file, and determine a target domain name corresponding to the environmental information from the domain name list based on a preset strategy; wherein the preset strategy is used to indicate a mapping relationship between multiple domain names in the domain name list and multiple preset environmental information.

[0065] In some embodiments, the request sending module 406 is specifically used to: send the target domain name to the domain name system resolution server based on the address of the domain name system resolution server predefined in the Nginx configuration file; determine the target forwarding address corresponding to the target domain name through the domain name system resolution server.

[0066] The request processing device provided in the embodiments of the present disclosure can execute the request processing method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.

[0067] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device embodiment can refer to the corresponding process in the method embodiment, and will not be repeated here.

[0068] An embodiment of the present disclosure provides an electronic device, which includes: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of any method in the present disclosure.

[0069] Reference below Figure 5 , which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present disclosure. The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0070] like Figure 5As shown, the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0071] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0072] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0073] In addition to the above-mentioned methods and devices, the embodiments of the present disclosure may also be a computer program product, which includes computer program instructions, which, when executed by a processor, cause the processor to perform the method provided by the embodiments of the present disclosure. The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present disclosure, the programming languages ​​including object-oriented programming languages ​​such as Java, C++, etc., and also conventional procedural programming languages ​​such as "C" language or similar programming languages. The program code may be executed entirely on a user computing device, partially on a user device, as an independent software package, partially on a user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0074] In addition, the embodiment of the present disclosure may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the request processing method provided by the embodiment of the present disclosure.

[0075] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0076] The embodiments of the present disclosure also provide a computer program product, including a computer program / instruction, which implements the request processing method in the embodiments of the present disclosure when executed by a processor.

[0077] It is understandable that before using the technical solutions disclosed in the various embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0078] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0079] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0080] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0081] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0082] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A request processing method, characterized in that: Applicable to Nginx server, including: Receive a target request sent by a user end; wherein the target request carries environment information of a target backend environment; Extracting the environment information carried by the target request, and determining a target domain name corresponding to the environment information from a plurality of preset domain names; Obtain a target forwarding address corresponding to the target domain name to send the target request to a backend server corresponding to the target forwarding address.

2. The method according to claim 1, characterized in that The environment information is information received by the user terminal through a preset control panel; and the environment information is stored by the user terminal in an environment field of a target file; The target file has a binding relationship with the domain name corresponding to the Nginx server, and the binding relationship is used to indicate that the target request sent by the user terminal to the Nginx server carries the field information of the target file.

3. The method according to claim 2, characterized in that The preset control panel is provided with a target control, and the target control is used to display the current backend environment information of the user terminal, and the target control is also used to receive the environment information of the target backend environment to be switched.

4. The method according to claim 1, characterized in that: The extracting the environment information carried by the target request and determining the target domain name corresponding to the environment information from a plurality of preset domain names includes: The target script is called based on the Nginx configuration file to extract the environment information carried by the target request through the target script, and the target domain name corresponding to the environment information is determined from multiple preset domain names.

5. The method according to any one of claims 1 to 4, characterized in that: The extracting the environment information carried by the target request includes: Identifying an environment field from field information of a target file carried in a hypertext transfer protocol request header of the target request; Environmental information is extracted based on the environmental field.

6. The method according to any one of claims 1 to 4, characterized in that: The step of determining a target domain name corresponding to the environment information from a plurality of preset domain names includes: Read a domain name list preset in an Nginx configuration file, and determine a target domain name corresponding to the environmental information from the domain name list based on a preset strategy; wherein the preset strategy is used to indicate a mapping relationship between multiple domain names in the domain name list and multiple preset environmental information.

7. The method according to claim 1, characterized in that The obtaining of the target forwarding address corresponding to the target domain name includes: Based on the address of the domain name system resolution server predefined in the Nginx configuration file, sending the target domain name to the domain name system resolution server; The target forwarding address corresponding to the target domain name is determined by the domain name system resolution server.

8. The method according to claim 1, characterized in that: The environmental information is attached to the hypertext transfer protocol request header of the target request.

9. An electronic device, characterized in that: The electronic device comprises: a storage device having a computer program stored thereon; A processing device, used to execute the computer program in the storage device to implement the steps of the request processing method according to any one of claims 1 to 8.

10. A computer program product, characterized in that The method comprises a computer program, which implements the request processing method according to any one of claims 1 to 8 when executed by a processor.