Request response method and device based on integrated configuration file, equipment and medium
By integrating the built-in variables of the configuration file and Nginx server, identifying and responding to application requests, the problem of increasing the number of configuration files and inefficient development is solved, and efficient configuration management is achieved.
Patent Information
- Application Number
- CN202411063661.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-05
- Publication Date
- 2024-12-31
AI Technical Summary
In application development, with the increase of applications, configuration files increase dramatically, resulting in inefficiency in manual configuration of developers. How to reduce the number of configuration files and improve development efficiency becomes a challenge.
By integrating configuration files, using the built-in variables and parsing rules of the Nginx server, we can identify the target subdomain name of the page access request and obtain the corresponding certificate file, realize the request response to the application, reduce the number of configuration files, and save developers' manual configuration time .
It implements the use of different subdomains to respond to various requests of the application, while reducing the number of configuration files, improving the development efficiency of configuration files, and simplifying the workflow of developers.
Smart Images

Figure CN119232784A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of Internet technology, and specifically relates to a request response method, device, equipment and medium based on an integrated configuration file. Background Art
[0002] With the rapid development of science and technology, people's requirements for applications are gradually increasing, and various types of applications have emerged.
[0003] In the process of application publishing, in order to improve the degree of refined processing of usage requests, multiple subdomains are often set up under a main domain name to deal with different types of access requests, so as to provide different subdomains to respond to different types of access requests, thereby improving the running stability of the application. However, in the actual implementation process, it is often necessary to generate a configuration file for each subdomain in the Nginx server (engine x, a high-performance HTTP and reverse proxy web server) of the application developer, and the developer configures them one by one, which leads to a sharp increase in configuration files as the number of applications increases, and the inefficiency of manual configuration by developers. Therefore, how to solve the above technical problems has become a top priority. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a request response method, device, equipment and medium based on an integrated configuration file, the purpose of which is to achieve the use of different subdomain names to respond to various requests of an application program through the integration of configuration files, while reducing the number of configuration files, saving developers' manual configuration time, and improving the development efficiency of configuration files.
[0005] In a first aspect, an embodiment of the present application provides a request response method based on an integrated configuration file, the method comprising:
[0006] Loading an integration configuration file; wherein the integration configuration file includes a first built-in variable and a second built-in variable;
[0007] Receive page access requests;
[0008] Identify the target subdomain of the page access request through the parsing rule in the first built-in variable of the integration configuration file;
[0009] Obtaining the certificate file corresponding to the target subdomain name through the second built-in variable of the integration configuration file;
[0010] The target subdomain name is accessed based on the certificate file.
[0011] Further, identifying the target subdomain of the page access request through the parsing rule in the first built-in variable of the integration configuration file includes:
[0012] Identifying the request type of the page access request through the parsing rule in the first built-in variable of the integration configuration file;
[0013] A target subdomain name matching the page access request is determined according to the request type.
[0014] Further, determining a target subdomain matching the page access request according to the request type includes:
[0015] Determine a subdomain name string corresponding to the request type according to the request type and a pre-stored subdomain name string;
[0016] A subdomain name matching the request type is determined as a target subdomain name according to the subdomain name character string.
[0017] Furthermore, before loading the integration configuration file, the method further includes:
[0018] Get at least two subdomains corresponding to the main domain name of the application;
[0019] Constructing resolution rules for at least two subdomains of the application;
[0020] The parsing rule is written into a first built-in variable of the Nginx server, the certificate file path corresponding to each subdomain name is determined through a second built-in variable of the Nginx server, and the first built-in variable and the second built-in variable are written into an integrated configuration file.
[0021] Furthermore, the method further comprises:
[0022] In response to a configuration operation on the basic configuration information of the integrated configuration file, the basic configuration information of the integrated configuration file is determined; wherein the basic configuration information is applicable to all subdomains of the primary domain name of the application.
[0023] Furthermore, the basic configuration information includes at least one of a maximum number of failures, a failure timeout, and a weight value.
[0024] In a second aspect, an embodiment of the present application provides a request response device based on an integrated configuration file, the device comprising:
[0025] A loading module, used to load an integrated configuration file; wherein the integrated configuration file includes a first built-in variable and a second built-in variable;
[0026] A receiving module, used for receiving a page access request;
[0027] A target subdomain name determination module, used to identify the target subdomain name of the page access request through the parsing rule in the first built-in variable of the integration configuration file;
[0028] A certificate file determination module, used to obtain the certificate file corresponding to the target subdomain name through the second built-in variable of the integration configuration file;
[0029] A forwarding module is used to access the target subdomain name based on the certificate file.
[0030] Furthermore, the target subdomain determination module is specifically used to:
[0031] Identifying the request type of the page access request through the parsing rule in the first built-in variable of the integration configuration file;
[0032] A target subdomain name matching the page access request is determined according to the request type.
[0033] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0034] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0035] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0036] In an embodiment of the present application, an integrated configuration file is loaded; wherein the integrated configuration file includes a first built-in variable and a second built-in variable; a page access request is received; the target subdomain of the page access request is identified through the parsing rule in the first built-in variable of the integrated configuration file; the certificate file corresponding to the target subdomain is obtained through the second built-in variable of the integrated configuration file; and the target subdomain is accessed based on the certificate file. The technical solution provided by the present application can realize the use of different subdomains to respond to various requests of the application, while reducing the number of configuration files, saving the manual configuration time of developers, and improving the development efficiency of configuration files. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1It is a flowchart of a request response method based on an integrated configuration file provided in Example 1 of the present application;
[0038] Figure 2 It is a flowchart of a request response method based on an integrated configuration file provided in Example 2 of the present application;
[0039] Figure 3 It is a comparison diagram before and after integration based on the integration configuration file provided in the second embodiment of the present application;
[0040] Figure 4 This is a schematic diagram comparing some code snippets of the integrated configuration file provided in Example 2 of the present application;
[0041] Figure 5 It is a structural diagram of a request response device based on an integrated configuration file provided in Embodiment 3 of the present application;
[0042] Figure 6 It is a schematic diagram of the structure of the electronic device provided in Example 4 of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all of the content is shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
[0044] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0045] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0046] In conjunction with the accompanying drawings, the following describes in detail the request response method, apparatus, device and medium based on the integrated configuration file provided by the embodiments of the present application through specific embodiments and their application scenarios.
[0047] Embodiment 1
[0048] Figure 1 is a flow chart of a request response method based on an integrated configuration file provided in the first embodiment of the present application. Figure 1 As shown, the specific steps include:
[0049] S101, loading an integration configuration file; wherein the integration configuration file includes a first built-in variable and a second built-in variable;
[0050] First, the present application is applicable to the scenario of configuring the server side of the application. Based on the above scenario, it can be understood that the execution subject of the present application can be a terminal device used for development or configuration, such as a desktop computer, a laptop computer, a tablet computer, a smart phone, and an intelligent auxiliary device.
[0051] The integration configuration file can be a configuration file, which can include configuration information for integrating all subdomains of the application. In this solution, the integration configuration file is a file. Compared with other related technologies that use each configuration file to correspond to a subdomain, only one file needs to be loaded during the loading process, and there is no need to load multiple configuration files. In this way, both in terms of data transmission and response speed, there is a certain improvement in effect.
[0052] The integrated configuration file includes a first built-in variable and a second built-in variable. It is understandable that different variables may have different functions. For example, the first built-in variable may be used to classify page access requests, and the second built-in variable may determine the certificate file to be used based on the classification.
[0053] In this solution, the Nginx server can load from other servers, where the other servers can be servers storing various types of configuration information of the application. The client or other servers can also load from the Nginx server, and the relevant configuration information can be clarified by loading to determine the subdomain name, the certificate file corresponding to the subdomain name, etc.
[0054] S102, receiving a page access request;
[0055] The page access request may be issued by a client, for example, the client issues an access request to a login page, an access request to a registration page, an access request to a game page, an access request to a recharge page, and the like.
[0056] S103, identifying the target subdomain of the page access request through the parsing rule in the first built-in variable of the integration configuration file;
[0057] In this solution, a parsing rule can be configured in the first built-in variable of the integrated configuration file, and the parsing rule can be used to parse the page access request to obtain the target subdomain name corresponding to the page access request. The parsing rule can be pre-configured, for example, if a login page access request is received, the target subdomain name corresponding to the login page access request can be parsed, and if a recharge page access request is received, the target subdomain name corresponding to the recharge page access request can be parsed.
[0058] S104, obtaining a certificate file corresponding to the target subdomain name through a second built-in variable of the integration configuration file;
[0059] It is understandable that after determining the target subdomain, the certificate file corresponding to the target subdomain can be determined based on the relevant information in the second built-in variable. The method of determining the certificate file corresponding to the target subdomain can be by configuring the corresponding relationship between each subdomain and the storage path of the certificate file in the second built-in variable, so that after determining the target subdomain, the storage path of the certificate file corresponding to the target subdomain can be determined through the corresponding relationship between each subdomain and the storage path of the certificate file, and then the certificate file can be accessed or recorded through the storage path to achieve the acquisition of the certificate file.
[0060] The certificate file can be used to ensure the legitimacy of the page that the user accesses. For example, if the certificate file is not available, the page may not be returned to the user, or the returned page may prompt "page is illegal". On the contrary, if the certificate file is available, the page can be accessed normally.
[0061] S105: Access the target subdomain based on the certificate file.
[0062] After obtaining the certificate file, the target subdomain can be accessed. It can be understood that if the target subdomain is used to display the user's login page, the relevant information of the login page can be fed back to the client after the access, so that the user can view the login page on the client.
[0063] In this solution, this step or all of the above steps can be executed by the Nginx server. It can be understood that after obtaining the target subdomain name and the certificate file, the user's page access request can be forwarded. On the one hand, with the target subdomain name, the forwarding target can be clearly identified. On the other hand, with the certificate file, the normal display of subsequent pages can be ensured.
[0064] The technical solution provided in this embodiment is to load an integrated configuration file; wherein the integrated configuration file includes a first built-in variable and a second built-in variable; receive a page access request; identify the target subdomain of the page access request through the parsing rule in the first built-in variable of the integrated configuration file; obtain the certificate file corresponding to the target subdomain through the second built-in variable of the integrated configuration file; and access the target subdomain based on the certificate file. The technical solution provided in this application can achieve the use of different subdomains to respond to various requests of the application, while reducing the number of configuration files, saving developers' manual configuration time, and improving the development efficiency of configuration files.
[0065] In one embodiment, optionally, identifying the target subdomain of the page access request through a parsing rule in the first built-in variable of the integration configuration file includes:
[0066] Identifying the request type of the page access request through the parsing rule in the first built-in variable of the integration configuration file;
[0067] A target subdomain name matching the page access request is determined according to the request type.
[0068] In this solution, the page access request may have different request types, such as a login request type, a registration request type, a recharge request type, etc. In this solution, the specific request type may be determined based on the field information of the received page access request, or the field or specific type number included in the request information.
[0069] After determining the request type, the target subdomain of the page access request can be determined according to the request type. For example, the target subdomain corresponding to each request type is predetermined, and after determining the request type of the current page access request, the corresponding target subdomain can be determined based on the request type as the target subdomain corresponding to the current page access request.
[0070] This technical solution, based on the above technical solution, provides a method for determining the target subdomain of a page access request based on the request type of the page request. This setting of the solution can quickly and accurately determine the target subdomain.
[0071] On the basis of the above technical solutions, optionally, determining a target subdomain matching the page access request according to the request type includes:
[0072] Determine a subdomain name string corresponding to the request type according to the request type and a pre-stored subdomain name string;
[0073] A subdomain name matching the request type is determined as a target subdomain name according to the subdomain name character string.
[0074] Among them, subdomain character strings, such as my, pay, mysdk, can be stored in the first built-in variable. After obtaining the request type, the subdomain character string corresponding to the request type can be determined based on the similarity or correlation between the request type and the subdomain character string. Then, the target subdomain is determined based on the subdomain character string, for example, the target subdomain is my.A.com, pay.A.com, mysdk.A.com, etc. Then, after receiving the page access request sent by the application user A, the page access request can be forwarded to the target subdomain to respond to the page access request.
[0075] Through such a setting, this solution can realize identification based on the subdomain character string in the process of determining the target subdomain, which can improve the accuracy of identification and avoid the problem of inaccurate response to page access requests caused by subdomain identification errors.
[0076] Embodiment 2
[0077] Figure 2It is a flow chart of the request response method based on the integrated configuration file provided in the second embodiment of the present application. This solution makes a better improvement on the above embodiment, and the specific improvement is: before loading the integrated configuration file, the method also includes: obtaining at least two subdomains corresponding to the main domain name of the application; constructing parsing rules for at least two subdomains of the application; writing the parsing rules into the first built-in variable of the Nginx server, determining the certificate file path corresponding to each subdomain through the second built-in variable of the Nginx server, and writing the first built-in variable and the second built-in variable into the integrated configuration file.
[0078] like Figure 2 As shown, the specific steps include:
[0079] S201, obtaining at least two subdomains corresponding to the primary domain name of the application;
[0080] The main domain name can be the domain name corresponding to each application, such as A.com. The subdomain name can be the domain name of different functions set for different access requests in an application of a main domain name, such as my.A.com, pay.A.com, mysdk.A.com, paysdk.A.com, etc.
[0081] S202, constructing resolution rules for at least two subdomains of the application;
[0082] The resolution rule may be a rule for resolving a subdomain name. For example, a target subdomain name corresponding to a page access request may be determined based on the resolution rule.
[0083] S203, writing the parsing rule into a first built-in variable of the Nginx server, determining the certificate file path corresponding to each subdomain name through a second built-in variable of the Nginx server, and writing the first built-in variable and the second built-in variable into an integrated configuration file;
[0084] The first built-in variable of the Nginx server can be $subdomain. The second built-in variable of the Nginx server can be $ssl_server_name. For example, if the primary domain name of an application corresponds to 10 subdomains, this solution can cleverly use the Nginx server built-in variable $ssl_server_name and $subdomain technology to integrate 10 configuration files into one configuration file, greatly shortening the domain name configuration time and improving operation and maintenance efficiency.
[0085] S204, loading an integration configuration file; wherein the integration configuration file includes a first built-in variable and a second built-in variable;
[0086] S205, receiving a page access request;
[0087] S206, identifying the target subdomain of the page access request through the parsing rule in the first built-in variable of the integration configuration file;
[0088] S207, obtaining a certificate file corresponding to the target subdomain name through a second built-in variable of the integration configuration file;
[0089] S208: Access the target subdomain based on the certificate file.
[0090] The technical solution provided in this embodiment, by utilizing Nginx's built-in $ssl_server_name variable and $subdomain variable to respectively solve the problems of different certificates and different subdomain proxy forwarding rules, integrates 10 configuration files into one configuration file, can significantly shorten the developer's time consumed by domain name configuration, and improve operation and maintenance efficiency.
[0091] In a feasible embodiment, optionally, the method further includes:
[0092] In response to a configuration operation on the basic configuration information of the integrated configuration file, the basic configuration information of the integrated configuration file is determined; wherein the basic configuration information is applicable to all subdomains of the primary domain name of the application.
[0093] The basic configuration information may include information related to the forwarding of page access requests, such as the number of forwarding times, the number of times the access was deemed to have failed, etc. For example, if no feedback is received after five forwardings, the forwarding is deemed to have failed. This solution can integrate the configuration files to write the basic configuration information that should be configured in multiple configuration files into one integrated file. Then, the configuration only needs to be done once in the integrated file, eliminating the need for developers to repeatedly configure, thereby improving the work efficiency of developers.
[0094] Based on the above embodiment, optionally, the basic configuration information includes: at least one of a maximum number of failures, a failure timeout period, and a weight value.
[0095] For example, max fails = 5, fail timeout = 5s, weight = 1. This configuration can be used to determine the maximum number of failures, failure timeout, and weight value. This allows a one-time configuration of an integrated configuration file to be applied to all subdomains without the need to configure each subdomain separately, thereby improving the development efficiency of developers.
[0096] Through such settings, this solution can simplify the configuration of basic configuration information such as the maximum number of failures, failure timeout, and weight value, improve the work efficiency of developers, and eliminate the need for developers to repeat tasks.
[0097] Figure 3 2 is a comparison diagram before and after the integration based on the integration configuration file provided in the second embodiment of the present application. Figure 3 As shown in the figure, without configuration file integration, we need to configure a configuration file for each of the multiple subdomains. For example, if 10 subdomains need to be set up under the main domain of an application, then when configuring the configuration file corresponding to each subdomain, 10 configuration files are required. If there are 3 applications, configuration files for 30 subdomains need to be configured. This will lead to the problem of very high configuration costs after there are too many subdomain configuration files. However, after the optimization of this solution, the Nginx built-in variable $ssl_server_name and $subdomain technology can be used to integrate 10 configuration files into one configuration file, which greatly shortens the domain name configuration time and improves the efficiency of operation and maintenance work.
[0098] Figure 4 This is a schematic diagram comparing some code snippets of the integrated configuration file provided in Example 2 of this application. Figure 4 As shown, before optimization, you need to configure the two subdomains my.e9h2d5.com.443.conf and mysdk.e9h2d5.com.443.conf respectively. The code is as follows:
[0099] For my.e9h2d5.com.443.conf section:
[0100] ssl certificate ssl / my.e9h2d5.com.crt; specifies the path to the SSL certificate file used for this site;
[0101] ssl_certificate_key ssl / my.e9h2d5.com.key; specifies the path of the key file corresponding to the certificate, which is used to establish a secure SSL connection;
[0102] server_name my.e9h2d5.com; indicates that this configuration applies to the domain name my.e9h2d5.com;
[0103] proxy_pass http: / / 63yx_my; means the request will be proxied to the address http: / / 63yx_my;
[0104] upstream 63yx_my{server 1.1.1.1:801max fails=5fail timeout=5sweight=1;
[0105] server 2.2.2.2:801max fails=5fail timeout=5s weight=1;}; An upstream server group named 63yx_my is defined. It contains two servers, 1.1.1.1:801 and 2.2.2.2:801. The maximum number of failures for each server is 5, the failure timeout is 5 seconds, and the weight is 1.
[0106] For mysdk.e9h2d5.com.443.conf section:
[0107] ssl certificate ssl / my.e9h2d5.com.crt: specifies the path to the SSL certificate file used for this site;
[0108] ssl_certificate_key ssl / my.e9h2d5.com.key: specifies the path to the key file corresponding to the certificate, which is used to establish a secure SSL connection;
[0109] server_name my.e9h2d5.com; indicates that this configuration applies to the domain name my.e9h2d5.com;
[0110] proxy_pass http: / / 63yx_my; means the request will be proxied to the address http: / / 63yx_my;
[0111] upstream 63yx_my{server 1.1.1.1:801max fails=5fail timeout=5sweight=1;
[0112] server 2.2.2.2:801max fails=5fail timeout=5s weight=1;}; An upstream server group named 63yx_my is defined. It contains two servers, 1.1.1.1:801 and 2.2.2.2:801. The maximum number of failures for each server is 5, the failure timeout is 5 seconds, and the weight is 1.
[0113] After optimization:
[0114] ssl certificate ssl / $ssl server_name.crt ssl certificate key ssl / $sslserver_name.key: Use the variable $ssl server_name to dynamically specify the file path of the SSL certificate and key, which means that depending on the server name, the corresponding certificate and key files will be loaded to implement secure connection configuration for different domain names;
[0115] server_name~(? <subdomain>.*).e9h2d5.com; This is a regular expression that matches any subdomain ending with .e9h2d5.com; by using the regular expression capture group (? <subdomain>.*), extract the subdomain part for use in subsequent configuration.
[0116] proxy_pass http: / / 63yx_$subdomain; According to the subdomain variable $subdomain extracted earlier, the request is proxied to the address of http: / / 63yx_ plus the subdomain.
[0117] upstream 63yx_my{server 1.1.1.1:801max fails=5fail timeout=5sweight=1;
[0118] server 2.2.2.2:801max fails=5fail timeout=5s weight=1;}; An upstream server group named 63yx_my is defined, which contains two servers 1.1.1.1:801 and 2.2.2.2:801. The maximum number of failures for each server is 5, the failure timeout is 5 seconds, and the weight is 1.
[0119] upstream 63yx_mysdk{server 1.1.1.1:802max fails=5fail timeout=5sweight=1;server 2.2.2.2:802max fails=5fail timeout=5s weight=1;}; Another upstream server group named 63yx_mysdk is defined, and the server configuration is similar to the above, but the port is 802.
[0120] After comparison, it can be seen that before optimization, the configuration was performed for a single specific domain name my.e9h2d5.com.
[0121] ssl certificate ssl / my.e9h2d5.com.crt and ssl_certificate_key ssl / my.e9h2d5.com.key clearly specify the certificate and key file paths corresponding to the domain name.
[0122] server_name my.e9h2d5.com; only matches the specific domain name my.e9h2d5.com.
[0123] proxy_pass http: / / 63yx_my; proxies the request to the specific http: / / 63yx_my address.
[0124] upstream 63yx_my{...} defines an upstream server group named 63yx_my.
[0125] After optimization, it is designed to handle all subdomains matching *.e9h2d5.com. Through the regular expression server_name~(? <subdomain>.*).e9h2d5.com; to capture the subdomain portion and use the $subdomain variable later.
[0126] ssl certificate ssl / $ssl server_name.crt ssl certificate key ssl / $sslserver_name.key Use the variable $ssl server_name to dynamically specify the certificate and key file paths so that the corresponding files can be loaded according to different subdomains.
[0127] proxy_pass http: / / 63yx_$subdomain; dynamically determine the target address of the proxy based on the captured subdomain name.
[0128] It also contains the upstream server group definitions of upstream 63yx_my{...} and upstream 63yx_mysdk{...}, but the $subdomain here will be replaced according to the actual subdomain name.
[0129] In general, before optimization, the configuration was specific to a single domain name, but after optimization, by using regular expressions and variables, it can more flexibly handle multiple subdomains with the same suffix, realizing a more general configuration method that can reduce the work of repeated configuration.
[0130] Embodiment 3
[0131] Figure 5 Schematic diagram of the structure of the request response device based on the integrated configuration file provided in the third embodiment of the present application. Figure 5 As shown, the device comprises:
[0132] A loading module 501 is used to load an integrated configuration file; wherein the integrated configuration file includes a first built-in variable and a second built-in variable;
[0133] Receiving module 502, used for receiving a page access request;
[0134] A target subdomain name determination module 503, configured to identify the target subdomain name of the page access request through a parsing rule in the first built-in variable of the integration configuration file;
[0135] A certificate file determining module 504 is used to obtain the certificate file corresponding to the target subdomain name through the second built-in variable of the integration configuration file;
[0136] The forwarding module 505 is used to access the target subdomain name based on the certificate file.
[0137] Furthermore, the target subdomain determination module 503 is specifically used to:
[0138] Identifying the request type of the page access request through the parsing rule in the first built-in variable of the integration configuration file;
[0139] A target subdomain name matching the page access request is determined according to the request type.
[0140] The technical solution provided in this embodiment is to load an integrated configuration file; wherein the integrated configuration file includes a first built-in variable and a second built-in variable; receive a page access request; identify the target subdomain of the page access request through the parsing rule in the first built-in variable of the integrated configuration file; obtain the certificate file corresponding to the target subdomain through the second built-in variable of the integrated configuration file; and access the target subdomain based on the certificate file. The technical solution provided in this application can achieve the use of different subdomains to respond to various requests of the application, while reducing the number of configuration files, saving developers' manual configuration time, and improving the development efficiency of configuration files.
[0141] The request response device based on the integrated configuration file in the embodiment of the present application can be a device, or a component, integrated circuit or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc., and the non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0142] The request response device based on the integrated configuration file in the embodiment of the present application can be a device with an operating system. The operating system can be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0143] The request response device based on the integrated configuration file provided in the embodiment of the present application can implement each process implemented in the above method embodiment, and will not be described again here to avoid repetition.
[0144] Embodiment 4
[0145] Figure 6 Schematic diagram of the structure of the electronic device provided in the fourth embodiment of the present application. Figure 6 As shown, the embodiment of the present application also provides an electronic device 600, including a processor 601, a memory 602, and a program or instruction stored in the memory 602 and executable on the processor 601. When the program or instruction is executed by the processor 601, each process of the above-mentioned request response device embodiment based on the integrated configuration file is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0146] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0147] Embodiment 5
[0148] The embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned request response device embodiment based on an integrated configuration file is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0149] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0150] Embodiment 6
[0151] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned request response device embodiment based on the integrated configuration file, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0152] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0153] It should be noted that, in this article, the terms "comprise", "include" 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, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0154] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0155] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0156] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.< / subdomain> < / subdomain> < / subdomain>
Claims
1. A request response method based on an integrated configuration file, characterized in that: The method comprises: Loading an integration configuration file; wherein the integration configuration file includes a first built-in variable and a second built-in variable; Receive page access requests; Identify the target subdomain of the page access request through the parsing rule in the first built-in variable of the integration configuration file; Obtaining the certificate file corresponding to the target subdomain name through the second built-in variable of the integration configuration file; The target subdomain name is accessed based on the certificate file.
2. The request response method based on integrated configuration file according to claim 1, characterized in that: Identifying the target subdomain of the page access request through the parsing rule in the first built-in variable of the integration configuration file includes: Identifying the request type of the page access request through the parsing rule in the first built-in variable of the integration configuration file; A target subdomain name matching the page access request is determined according to the request type.
3. The request response method based on integrated configuration file according to claim 2 is characterized in that: Determining a target subdomain matching the page access request according to the request type includes: Determine a subdomain name string corresponding to the request type according to the request type and a pre-stored subdomain name string; A subdomain name matching the request type is determined as a target subdomain name according to the subdomain name character string.
4. The request response method based on integrated configuration file according to claim 1, characterized in that: Before loading the integration configuration file, the method further includes: Get at least two subdomains corresponding to the main domain name of the application; Constructing resolution rules for at least two subdomains of the application; The parsing rule is written into a first built-in variable of the Nginx server, the certificate file path corresponding to each subdomain name is determined through a second built-in variable of the Nginx server, and the first built-in variable and the second built-in variable are written into an integrated configuration file.
5. The request response method based on integrated configuration file according to claim 4 is characterized in that: The method further comprises: In response to a configuration operation on the basic configuration information of the integrated configuration file, the basic configuration information of the integrated configuration file is determined; wherein the basic configuration information is applicable to all subdomains of the primary domain name of the application.
6. The request response method based on integrated configuration file according to claim 5, characterized in that: The basic configuration information includes: at least one of a maximum number of failures, a failure timeout, and a weight value.
7. A request response device based on an integrated configuration file, characterized in that: The device comprises: A loading module, used to load an integrated configuration file; wherein the integrated configuration file includes a first built-in variable and a second built-in variable; A receiving module, used for receiving a page access request; A target subdomain name determination module, used to identify the target subdomain name of the page access request through the parsing rule in the first built-in variable of the integration configuration file; A certificate file determination module, used to obtain the certificate file corresponding to the target subdomain name through the second built-in variable of the integration configuration file; A forwarding module is used to access the target subdomain name based on the certificate file.
8. The request response device based on integrated configuration file according to claim 7, characterized in that: The target subdomain determination module is specifically used to: Identifying the request type of the page access request through the parsing rule in the first built-in variable of the integration configuration file; A target subdomain name matching the page access request is determined according to the request type.
9. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the request response method based on the integrated configuration file as described in any one of claims 1 to 6.
10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the request response method based on an integrated configuration file as described in any one of claims 1 to 6 are implemented.