Request processing method, apparatus, device, storage medium, and program product

By specially identifying and processing complex HTTP requests in the client browser and microservice gateway, transforming them into simple requests, the problem of server and gateway pressure caused by preflight requests in existing technologies is solved, achieving more efficient request processing and improved website performance.

CN119676224BActive Publication Date: 2025-12-16INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411863668.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-12-16
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

In existing technologies, complex HTTP requests require preflight requests during webpage rendering, which puts excessive pressure on servers and gateways, resulting in poor website performance and low request processing efficiency.

Method used

By determining the request type in the client browser and the microservice gateway, complex requests are specially marked and transformed into simple requests. The microservice gateway acts as an intermediary to restore the processed request to the original request and send it directly to the microservice for processing, thus avoiding the generation of preflight requests.

Benefits of technology

It improves the efficiency of handling complex requests, reduces the pressure on servers and gateways, and enhances the website's processing performance and request processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119676224B_ABST
    Figure CN119676224B_ABST
Patent Text Reader

Abstract

The application provides a request processing method and device, equipment, storage medium and program product, and relates to the field of financial technology. The method comprises the following steps: in response to a page access request of a user, initiating a first request, wherein the first request is a hypertext transfer protocol request to be transmitted; obtaining the request header of the first request; determining whether the first request is a simple request; if the first request is not a simple request, performing special identification processing on the request header to obtain an identified request header; emptying the request header of the first request and adding the identified request header to the non-request header of the first request to obtain a second request, wherein the second request is a processed hypertext transfer protocol request; and sending the second request to a micro-service gateway, so that the micro-service gateway restores the second request to the first request and sends the first request to a micro-service for request processing. The method of the application enhances the website processing performance and improves the complex request processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of financial technology, and in particular to a request processing method and device, equipment, a storage medium and a program product. BACKGROUND

[0002] With the continuous development of Internet web technology, client devices are also iteratively upgraded, and web front ends need to undertake more tasks in page rendering. The interfaces called by the front end are also becoming more and more complex, and most of the HyperText Transfer Protocol (HTTP) simple requests, especially the simple request limit of several headers in the HTTP request header, cannot meet the needs of most application scenarios, and complex requests are used more and more frequently. Complex requests will first send a preflight request to the server to test control, and the client will continue to send an actual request to obtain data after receiving the preflight request response from the server. In this process, a total of 4 back-and-forth serial requests are made, a total of 2 times. In this case, the preflight request increases the pressure on the server and the gateway.

[0003] In the prior art, the request processing method sets the Access-Control-Max-Age attribute, that is, the cache time of the preflight request, in the Nginx proxy layer of each front-end service. After a HTTP pre-request passes through the Nginx proxy of the front-end server, the cache result is cached, and the same complex request will not trigger a preflight request when it is initiated again through Nginx in the same browser within the cache time.

[0004] However, the prior art method still sends a preflight request for a complex request, and there are technical problems of poor website processing performance and low processing efficiency during request processing. SUMMARY

[0005] The present application provides a request processing method, device, equipment, storage medium and program product to solve the technical problems of poor website processing performance and low processing efficiency during request processing.

[0006] In a first aspect, the present application provides a request processing method applied to a client browser, comprising:

[0007] In response to a user's access page request, a first request is initiated, wherein the first request is a HyperText Transfer Protocol request to be transmitted;

[0008] The request header of the first request is obtained;

[0009] determining whether the first request is a simple request;

[0010] performing special identification processing on the request header to obtain an identified request header if the first request is not a simple request;

[0011] emptying the request header of the first request and adding the identified request header to a non-request header of the first request to obtain a second request, wherein the second request is a processed hypertext transfer protocol request;

[0012] sending the second request to the micro-service gateway to make the micro-service gateway restore the second request to the first request and send the first request to the micro-service for request processing.

[0013] In a second aspect, the application provides a request processing method applied to a micro-service gateway, comprising:

[0014] receiving a second request sent by a client browser, wherein the second request is obtained by the client browser in response to a user's access page request, initiating a first request, obtaining a request header of the first request, determining whether the first request is a simple request, and if the first request is not a simple request, performing special identification processing on the request header to obtain an identified request header, emptying the request header of the first request, and adding the identified request header to a non-request header of the first request to obtain the second request, wherein the first request is a hypertext transfer protocol request to be transmitted;

[0015] restoring the second request to the first request;

[0016] sending the first request to the micro-service for request processing.

[0017] In a third aspect, the application provides a request processing device applied to a client browser, comprising:

[0018] a starting module configured to initiate a first request in response to a user's access page request, wherein the first request is a hypertext transfer protocol request to be transmitted;

[0019] an obtaining module configured to obtain a request header of the first request;

[0020] a determining module configured to determine whether the first request is a simple request;

[0021] an identifying module configured to perform special identification processing on the request header to obtain an identified request header if the first request is not a simple request;

[0022] a processing module configured to empty the request header of the first request and add the identified request header to a non-request header of the first request to obtain a second request, wherein the second request is a processed hypertext transfer protocol request;

[0023] The first sending module sends the second request to the micro-service gateway, so that the micro-service gateway restores the second request to the first request and sends the first request to the micro-service for request processing.

[0024] In a fourth aspect, the application provides a request processing apparatus applied to a micro-service gateway, comprising:

[0025] The receiving module is configured to receive a second request sent by a client browser, wherein the second request is initiated by the client browser in response to a user's access page request, the first request is obtained, it is judged whether the first request is a simple request, if the first request is not a simple request, the request header is processed by special identification to obtain an identified request header, the request header of the first request is emptied, and the identified request header is added to the non-request header of the first request to obtain the first request, and the first request is a hypertext transfer protocol request to be transmitted;

[0026] The restoring module is configured to restore the second request to the first request.

[0027] The second sending module is configured to send the first request to the micro-service for request processing.

[0028] In a fifth aspect, the application embodiment provides a request processing device, comprising a memory and a processor.

[0029] The memory stores computer execution instructions.

[0030] The processor executes the computer execution instructions stored in the memory, so that the processor executes the method of the first aspect.

[0031] In a sixth aspect, the application embodiment provides a request processing device, comprising a memory and a processor.

[0032] The memory stores computer execution instructions.

[0033] The processor executes the computer execution instructions stored in the memory, so that the processor executes the method of the second aspect.

[0034] In a seventh aspect, the application embodiment provides a computer readable storage medium, the computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the method of the first aspect.

[0035] In an eighth aspect, the application embodiment provides a computer readable storage medium, the computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the method of the second aspect.

[0036] In a ninth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method of the first aspect above.

[0037] In a tenth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method of the second aspect above

[0038] The request processing method, device, equipment, storage medium and program product provided by the present application determine the request type of the hypertext transfer protocol request of the user through a preset judgment standard, perform special processing on the first request (the hypertext transfer protocol request to be transmitted) of the non-simple request, that is, perform identification processing on the request header and reorganize the request structure to generate a second request (the processed hypertext transfer protocol request), convert the complex request into a simple request, skillfully use the micro-service gateway as an intermediary, restore the processed second request to the original first request, and forward the first request to the corresponding micro-service for request processing. For the load request, a pre-check request does not need to be generated in the processing process, the performance of the webpage is improved, the bandwidth is saved, and the server / gateway pressure is reduced, the technical effects of enhancing the website processing performance and improving the complex request processing efficiency are achieved. BRIEF DESCRIPTION OF DRAWINGS

[0039] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present application and, together with the specification, serve to explain the principles of the application.

[0040] Figure 1 An application data processing system architecture schematic diagram is provided for an embodiment of the present application.

[0041] Figure 2 A flowchart of a request processing method is provided for an embodiment of the present application. Figure One ;

[0042] Figure 3 A flowchart of a request processing method is provided for an embodiment of the present application. Figure Two ;

[0043] Figure 4 A flowchart of a request processing method is provided for an embodiment of the present application.

[0044] Figure 5 A flowchart of a request processing method is provided for an embodiment of the present application. Figure Three ;

[0045] Figure 6 A flowchart of a request processing method is provided for an embodiment of the present application. Figure Four ;

[0046] Figure 7 A principle schematic diagram of a request processing method provided for an embodiment of the present application is shown in FIG. 1.

[0047] Figure 8 A flow schematic diagram of a request processing method provided for an embodiment of the present application is shown in FIG. 2. Figure Five

[0048] Figure 9 A structure schematic diagram of a request processing apparatus provided for an embodiment of the present application is shown in FIG. 3. Figure One

[0049] Figure 10 A structure schematic diagram of a request processing apparatus provided for an embodiment of the present application is shown in FIG. 4. Figure Two

[0050] Figure 11 A structure schematic diagram of a request processing device provided for an embodiment of the present application is shown in FIG. 5. Figure One

[0051] Figure 12 A structure schematic diagram of a request processing device provided for an embodiment of the present application is shown in FIG. 6. Figure Two

[0052] The above figures have shown the embodiments of the present application, which will be described in more details hereinafter. These figures and the following description are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0053] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The same or similar components are denoted by the same reference numerals throughout the drawings and the following description. The embodiments described in the following exemplary embodiments are not meant to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.

[0054] It should be noted that the request processing method, apparatus, device, storage medium and product provided by the present application can be used in the field of financial technology, and can also be used in any field other than financial technology. The application field of the request processing method, apparatus, device, storage medium and product provided by the present application is not limited.

[0055] The prior art method still sends a pre-check request for a complex request, which causes the technical problems of poor website processing performance and low processing efficiency during request processing.

[0056] ​​​​​To solve the above problems, the application provides a request processing method, device, equipment, storage medium and product, which judges the request type of the hypertext transfer protocol request of the user through a preset judgment standard, specially processes the complex request, converts the complex request into a simple request, ingeniously uses the micro-service gateway as an intermediary, restores the processed second request to the original first request, recovers to the original complex request, and forwards to the corresponding micro-service for request processing, thereby meeting the demand of improving the complex request processing efficiency.

[0057] Further, by responding to the user's access page request in a timely manner, the first request is initiated, laying a foundation for subsequent data transmission and processing, the request type is accurately judged by analyzing the request header information, and the request header of the complex request is specially processed, so that the request can be accurately identified and processed in the subsequent transmission and restoration process. In addition, the request header of the first request is emptied, and the identification of the subsequent request header is added to the non-request header of the first request, ensuring the validity of the request. Furthermore, the processed second request is sent to the micro-service gateway, the forwarding and routing functions of the gateway are used to realize flexible distribution of the request. Finally, the micro-service gateway restores the second request to the first request and sends the first request to the micro-service for request processing, ensuring the integrity and accuracy of the request, and improving the flexibility and scalability of the micro-service architecture, achieving the technical effects of enhancing the website processing performance and improving the complex request processing efficiency.

[0058] Figure 1 An application data processing system architecture provided by the embodiment of the application Figure One The application data processing system is a computer device and is applied to a client browser. As shown in the figure Figure 1 The above architecture includes a data acquisition device 101 and a display device 102.

[0059] It can be understood that the structure shown in the embodiment of the application does not constitute a specific limitation on the application data processing system architecture. In other feasible embodiments of the application, the above architecture can include more or fewer components than the figure, or combine certain components, or split certain components, or different component arrangement, which can be determined according to the actual application scene, and is not limited herein. Figure 1 The components shown in the figure can be realized by hardware, software, or a combination of software and hardware.

[0060] In the specific implementation process, the data acquisition device 101 can include an input / output interface and a communication interface, and the data acquisition device 101 can be connected with the processing device through the input / output interface or the communication interface.

[0061] The display device 102 can also be a touch display screen or a screen of a terminal device for receiving user instructions while displaying the above-mentioned content to realize interaction with the user.

[0062] It should be understood that the above processing device can be implemented by a processor reading instructions in a memory and executing the instructions, or by a chip circuit.

[0063] In addition, the network architecture and service scenarios described in the embodiments of the present application are for more clearly illustrating the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that, with the evolution of network architecture and the appearance of new service scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.

[0064] The technical solutions of the present application and how the technical solutions of the present application solve the above-mentioned technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.

[0065] Figure 2 Flowchart of a request processing method provided by an embodiment of the present application Figure One As shown in Figure 2 The request processing method provided by the embodiments of the present application is applied to a client browser, and includes:

[0066] S201, in response to a user's request for accessing a page, initiating a first request, wherein the first request is a hypertext transfer protocol request to be transmitted;

[0067] After the user applies to access the client browser, the client browser initiates a hypertext transfer protocol request to be transmitted in response to the request for accessing a page.

[0068] S202, obtaining the request header of the first request;

[0069] According to the initiated hypertext transfer protocol request to be transmitted, the client browser obtains the corresponding request header information.

[0070] S203, determining whether the first request is a simple request;

[0071] According to the hypertext transfer protocol request to be transmitted, the client determines whether it is a simple request.

[0072] S204, if the first request is not a simple request, performing special identification processing on the request header to obtain an identified request header;

[0073] In this embodiment, the following two conditions are met at the same time, which belongs to simple request. 1, the request method is one of the following three methods: HEAD / GET / POST; 2, the HTTP header information does not exceed the following fields: Accept / Accept-Language / Content-Language / Last-Event-ID / Content-Type (limited to three values application / x-www-form-urlencoded, multipart / form-data, text / plain), if any condition is not met, it is a non-simple request.

[0074] After determining that the hypertext transfer protocol request to be transmitted is not a simple request, the client browser adds a special identifier to the parameter of the request header of the determined hypertext transfer protocol request to be transmitted, and obtains the corresponding identifier after the request header.

[0075] It should be noted that if the hypertext transfer protocol request to be transmitted is a simple request, since the simple request does not have an identifier header, no pre-check request will be generated.

[0076] S205, empty the request header of the first request, and add the identifier after the request header to the non-request header of the first request to obtain the second request, wherein the second request is the processed hypertext transfer protocol request;

[0077] After the client browser obtains the identifier after the request header, it continues to empty the request header of the hypertext transfer protocol request to be transmitted, and adds the identifier after the request header to the non-request header of the hypertext transfer protocol request to be transmitted, and further obtains the processed hypertext transfer protocol request.

[0078] S206, send the second request to the micro-service gateway, so that the micro-service gateway restores the second request to the first request, and sends the first request to the micro-service for request processing.

[0079] For the processed hypertext transfer protocol request, the client browser sends it to the micro-service gateway through data transmission, so that the micro-service gateway restores the processed hypertext transfer protocol request back to the initial hypertext transfer protocol request to be transmitted, and sends the hypertext transfer protocol request to be transmitted to the micro-service for request processing.

[0080] Specifically, taking the hyper text transfer protocol request parameter with "H-" as an example, the "H-" starting parameter in the hyper text transfer protocol (HTTP) request is converted to the request header, the request with the expected header is sent from the gateway to the corresponding micro service, the micro service parses the header information in the request and processes the business logic, and then sequentially returns the interface response data to the client browser at one time.

[0081] The request processing method provided by the embodiment establishes a foundation for subsequent data transmission and processing by responding to the user's access page request in time in the client browser, accurately judges the type of the request by analyzing the request header information, and specially processes the request header of the complex request, so that the request can be accurately identified and processed in the subsequent transmission and restoration process. At the same time, by emptying the request header of the first request and adding the identified second request header to the non-request header of the first request, the effectiveness of the request is ensured. In addition, the processed second request is sent to the micro service gateway, the flexible distribution of the request is realized by using the forwarding and routing functions of the gateway, finally, the micro service gateway restores the second request to the first request, and sends the first request to the micro service for request processing, ensuring the completeness and accuracy of the request, and improving the flexibility and scalability of the micro service architecture, realizing the technical effects of enhancing the website processing performance and improving the complex request processing efficiency.

[0082] Figure 3 The flowchart of the request processing method provided by the embodiment of the application Figure Two As shown in Figure 3 The request processing method provided by the embodiment of the application is applied to a micro service gateway, and includes the following steps:

[0083] S301, receiving a second request sent by a client browser, wherein the second request is a first request initiated by the client browser in response to a user's access page request, the request header of the first request is obtained, it is judged whether the first request is a simple request, if the first request is not a simple request, the request header is specially identified and processed to obtain an identified request header, the request header of the first request is emptied, and the identified request header is added to the non-request header of the first request to obtain the first request, which is a hyper text transfer protocol request to be transmitted;

[0084] The micro service gateway receives the processed hyper text transfer protocol request obtained by the above steps S301-S305 sent by the client browser.

[0085] S302, restoring the second request to the first request;

[0086] The micro service gateway restores the processed hyper text transfer protocol request to the hyper text transfer protocol request to be processed.

[0087] S303, sending the first request to the microservice for request processing.

[0088] The microservice gateway continues to send the restored to-be-processed hypertext transfer protocol request to the microservice for request processing.

[0089] The request processing method provided in this embodiment ensures the consistency of the request in the processing process and saves the time cost by receiving the second request sent by the client browser and restoring the second request to the first request. In addition, the accuracy of complex request processing is ensured by sending the first request to the microservice for request processing, thereby achieving the technical effects of enhancing the website processing performance and improving the complex request processing efficiency.

[0090] Figure 4 A flow interaction diagram of the request processing method provided in this embodiment is shown in Figure 4 The request processing method provided in this embodiment includes the following steps.

[0091] S401, the client browser initiates a first request in response to a user's access page request, wherein the first request is a to-be-transmitted hypertext transfer protocol request;

[0092] S402, the client browser acquires the request header of the first request;

[0093] S403, the client browser determines whether the first request is a simple request;

[0094] S404, if the first request is not a simple request, the client browser performs special identification processing on the request header to obtain an identified request header;

[0095] S405, the client browser clears the request header of the first request and adds the identified request header to the non-request header of the first request to obtain a second request, wherein the second request is a processed hypertext transfer protocol request;

[0096] S406, the client browser sends the second request to the microservice gateway.

[0097] S407, the microservice gateway receives the second request sent by the client browser, wherein the second request is obtained by the client browser in response to a user's access page request, initiating a first request, acquiring the request header of the first request, determining whether the first request is a simple request, if the first request is not a simple request, performing special identification processing on the request header to obtain an identified request header, clearing the request header of the first request, and adding the identified request header to the non-request header of the first request, the first request is a to-be-transmitted hypertext transfer protocol request;

[0098] S408, the micro-service gateway restores the second request to the first request.

[0099] S409, the micro-service gateway sends the first request to the micro-service for request processing.

[0100] The request processing method provided by the embodiment can timely respond to the user's access page request, initiate a first request, lay a foundation for subsequent data transmission and processing, accurately determine the type of the request by analyzing the request header information, and specially process the request header of a complex request, so that the request can be accurately identified and processed in the subsequent transmission and restoration process. At the same time, the request header of the first request is emptied, and the identified subsequent request header is added to the non-request header of the first request, so as to ensure the validity of the request. In addition, the processed second request is sent to the micro-service gateway, the forwarding and routing functions of the gateway are used to realize flexible distribution of the request. Finally, the micro-service gateway restores the second request to the first request, and sends the first request to the micro-service for request processing, so as to ensure the completeness and accuracy of the request, improve the flexibility and scalability of the micro-service architecture, and achieve the technical effects of enhancing the processing performance of the website and improving the complex request processing efficiency.

[0101] Optionally, Figure 5 The flowchart of the request processing method provided by the embodiment of the application is shown in Figure Three As shown in Figure 5 On the basis of the above-mentioned embodiment, the embodiment is applied to a client browser, and the acquisition process of the second request is described in detail, including:

[0102] S501, emptying the request header of the first request;

[0103] The original request header of the hypertext transfer protocol request to be transmitted is processed.

[0104] S502, obtaining the uniform resource locator of the first request;

[0105] In the embodiment, the uniform resource locator is referred to as URL, which is a string address used to locate Internet resources.

[0106] The uniform resource locator of the hypertext transfer protocol request to be transmitted is obtained.

[0107] S503, adding the identified subsequent request header to the uniform resource locator of the first request to obtain the second request.

[0108] The identified subsequent request header parameter information is added to the uniform resource locator of the hypertext transfer protocol request to be transmitted, so as to obtain the processed hypertext transfer protocol request.

[0109] The request processing method provided by the embodiment can selectively control which information is sent to the server, improve the flexibility of request processing, and increase the identification and security of the request by specially processing or marking the request header, thereby ensuring the authenticity and integrity of the request. In addition, adding the identified request header information to the uniform resource locator enables the subsequent micro-service gateway to make more intelligent routing decisions based on the information, saves bandwidth and reduces server / gateway pressure, enhances website processing performance, and improves complex request processing efficiency.

[0110] Optionally, Figure 6 The flowchart of the request processing method provided by the embodiment of the application is shown in Figure Four As shown in Figure 6 The embodiment is applied to a client browser based on the above-mentioned embodiment, and the acquisition process of the identified request header is described in detail, including:

[0111] S601, acquiring the request header of the first request;

[0112] S601, acquiring the request header of the first request;

[0113] S602, acquiring the request method and the request header field of the first request;

[0114] S602, acquiring the request method and the request header field of the first request;

[0115] S603, judging whether the first request is a simple request according to the request method and the request header field;

[0116] S603, judging whether the first request is a simple request according to the request method and the request header field;

[0117] S604, if the first request is not a simple request, acquiring a preset prefix;

[0118] S604, if the first request is not a simple request, acquiring a preset prefix;

[0119] S605, adding the preset prefix to the request header to obtain an identified request header.

[0120] S605, adding the preset prefix to the request header to obtain an identified request header.

[0121] Specifically, the user accesses the page of the front-end application, the front-end page, that is, the hypertext transfer protocol (HTTP) request to be transmitted is initiated from the browser, the JavaScript (js) engine in the front-end intercepts the setRequestHeader method of the XML hypertext transfer request (XMLHttpRequest, XHR) instance by means of rewriting and covering, intercepts the setting of the request header (header) of all requests, adds a prefix "H-" to the header, manually splices the header into a uniform resource locator (URL), and then clears the original header carried by the request to change the complex request into a simple request. For example, a certain HTTP request "http: xxx.com / test_api" needs to carry a self-defined header such as "my_header: 1". Since the request carries a self-defined header, it belongs to a complex request, and the browser will first initiate a pre-check request for the request. However, after the request is intercepted, the request header is removed and spliced into the URL, such as "http: xxx.com / test_api?H-my_header=1".

[0122] The request processing method provided in the embodiment ensures the integrity of the request content by obtaining the request header and the request method of the first request, improves the identification and processing capability of the request by judging whether the first request is a simple request and adding a preset prefix to the request header, saves the time cost required for processing, and further improves the flexibility and customizability of the request processing by adding the preset prefix, thereby achieving the technical effects of enhancing the processing performance of the website and improving the processing efficiency of the complex request.

[0123] Optionally, Figure 7 The principle diagram of the request processing method provided in the embodiment is shown in FIG. 1. Figure 7 As shown in the figure, web refers to a web page, Spring Cloud Gateway refers to a Spring cloud gateway, Spring is a widely used Java application architecture, TransferHeaderFitler refers to a request header filter, HTTP refers to a hypertext transfer protocol, and header refers to a request header. The embodiment of the application provides a principle diagram of a pre-check request optimization scheme based on a Spring Cloud Gateway. A Spring Cloud Gateway gateway of a micro-service architecture can be accessed by a plurality of web front-end applications.

[0124] The web front-end application initiates an HTTP simple request from the browser and splices header information into the parameter of the HTTP request and adds a special identifier. When the request reaches the gateway, the special parameter in the HTTP simple request parameter is stripped out by the TransferHeaderFitler filter and converted into a header, so that the simple request is restored to a complex request with a header and forwarded to other microservices. Since the web front-end application from the browser is only an HTTP simple request (without a header), no pre-check request is generated, and the complex request with the expected header field reaches each microservice node, thereby achieving the original purpose and reducing the pre-check request, speeding up the interface response and improving the overall performance of the webpage.

[0125] It can be understood that, Figure 7 The effect diagram is only illustrative and does not affect the protection scope of the embodiments of the application.

[0126] Optionally, Figure 8 The flowchart of the request processing method provided by the embodiments of the application Figure Five As Figure 8 shown, the embodiments are applied to the microservice gateway on the basis of the above embodiments, and the restoration process of the first request is supplemented and described, including:

[0127] S801, identifying the identified request header according to the special identifier;

[0128] According to the special identifier after special processing, the identified request header is identified.

[0129] S802, restoring the identified request header to obtain the request header;

[0130] The identified request header is restored to obtain the processed request header.

[0131] S803, adding the request header to the request header of the second request, and deleting the identified request header in the non-request header of the second request to obtain the first request.

[0132] The request header is added to the request header corresponding to the processed hypertext transfer protocol request, and the identified request header is deleted in the non-request header of the processed hypertext transfer protocol request, and the initial hypertext transfer protocol request to be transmitted is further obtained.

[0133] Specifically, the micro-service gateway can uniformly process HTTP requests from the client browser front-end node, and a request header filter (TransferHeaderFitler) is customized in the gateway to intercept all hypertext transfer protocol (HTTP) requests; in this filter, the get query parameter method (getQueryParams) is used to obtain all current request parameters and assign them to an array, and a for loop is used to traverse the array of all request parameters to remove the "H-" prefix in the request parameters, and then set the request header (httpHeader.set) method to set it to the request header, and keep the parameters without the "H-" prefix in the URL, for example "http:xxx.com / test_api?H-my_header=1", after processing by the request header filter TransferHeaderFitler, the uniform resource locator (URL) becomes "http:xxx.com / test_api" and is added with the request header "my_header:1", that is, it is restored to the expected complex request.

[0134] The request processing method provided by the embodiment can ensure the integrity and accuracy of the request header information, improve the accuracy of request processing, enhance the flexibility and scalability of the system, and achieve the technical effects of enhancing the processing performance of a website and improving the efficiency of complex request processing.

[0135] Figure 9 The structure of a request processing device provided by the embodiment of the application Figure One The device of the embodiment can be in the form of software and / or hardware. Figure 9 As shown in the figure, the request processing device 900 provided by the embodiment of the application is applied to a client browser, and the device comprises an initiating module 901, an obtaining module 902, a judging module 903, an identifying module 904, a processing module 905, and a first sending module 906.

[0136] The initiating module 901 is configured to initiate a first request in response to a user's access page request, wherein the first request is a hypertext transfer protocol request to be transmitted.

[0137] The obtaining module 902 is configured to obtain the request header of the first request.

[0138] The judging module 903 is configured to judge whether the first request is a simple request.

[0139] The identifying module 904 is configured to perform special identification processing on the request header to obtain an identified request header if the first request is not a simple request.

[0140] The processing module 905 is configured to empty the request header of the first request, and add an identified post-request header to the non-request header of the first request to obtain a second request, where the second request is a processed hypertext transfer protocol request.

[0141] The first sending module 906 is configured to send the second request to the micro-service gateway, so that the micro-service gateway restores the second request to the first request, and sends the first request to the micro service for request processing.

[0142] In a possible implementation, the processing module 905 is further configured to:

[0143] empty the request header of the first request;

[0144] obtain a uniform resource locator of the first request;

[0145] add the identified post-request header to the uniform resource locator of the first request to obtain the second request.

[0146] In a possible implementation, the identification module 904 is further configured to:

[0147] obtain a preset prefix;

[0148] add the preset prefix to the request header to obtain the identified post-request header.

[0149] In a possible implementation, the judgment module 903 is further configured to:

[0150] obtain a request method and a request header field of the first request;

[0151] determine whether the first request is a simple request according to the request method and the request header field.

[0152] The request processing apparatus provided in this embodiment can execute the method provided in the method embodiment, and has similar implementation principles and technical effects, which will not be described here.

[0153] Figure 10 The structure of the request processing apparatus provided in this embodiment Figure Two The apparatus of this embodiment can be in the form of software and / or hardware. Figure 10 As shown in the figure, the request processing apparatus 1000 provided in this embodiment is applied to a micro-service gateway, and the apparatus includes a receiving module 1001, a restoring module 1002, and a second sending module 1003.

[0154] The receiving module 1001 is used to receive a second request sent by the client browser. The second request is a response from the client browser to the user's request to access the page. The browser initiates a first request, obtains the request header of the first request, determines whether the first request is a simple request, and if the first request is not a simple request, performs special identification processing on the request header to obtain an identified request header, clears the request header of the first request, and adds the identified request header to the non-request header of the first request. The first request is a Hypertext Transfer Protocol request to be transmitted.

[0155] The restore module 1002 is used to restore the second request to the first request;

[0156] The second sending module 1003 is used to send the first request to the microservice for request processing.

[0157] In one possible implementation, the restoration module 1002 is further configured to:

[0158] Based on the special identifier, identify the identifier and request the header;

[0159] The request headers after the identifier are restored to obtain the request headers;

[0160] Add the request header to the request header of the second request, and remove the identifier after the request header in the non-request header of the second request to obtain the first request.

[0161] The request processing device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0162] Figure 11 A schematic diagram of the structure of a request processing device provided in this application Figure One .like Figure 11 As shown, the electronic device 1100 provided in this embodiment is applied to a client browser and includes: at least one processor 1101 and a memory 1102. Optionally, the device 1100 also includes a communication component 1103. The processor 1101, memory 1102, and communication component 1103 are connected via a bus.

[0163] In the specific implementation process, at least one processor 1101 executes computer execution instructions stored in memory 1102, causing at least one processor 1101 to execute the above-described method applied to the client browser.

[0164] The specific implementation process of processor 1101 can be found in the above-described method embodiment applied to the client browser. Its implementation principle and technical effect are similar, and will not be repeated here.

[0165] Figure 12A structure of a request processing device provided in the present application Figure Two As shown in Figure 12 The electronic device 1200 provided in the embodiment is applied to a micro-service gateway and includes at least one processor 1201 and a memory 1202. Optionally, the device 1200 further includes a communication component 1203. The processor 1201, the memory 1202 and the communication component 1203 are connected through a bus.

[0166] In the implementation process, the at least one processor 1201 executes the computer-executable instructions stored in the memory 1202, so that the at least one processor 1201 performs the method applied to the micro-service gateway.

[0167] The specific implementation process of the processor 1201 can refer to the method applied to the micro-service gateway, which has similar implementation principles and technical effects, and will not be described here.

[0168] In the above embodiments, it should be understood that the processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC) and the like. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly embodied as the execution of the hardware processor, or the execution of the combination of the hardware and software modules in the processor.

[0169] The memory can include a random access memory (RAM) and can also include a non-volatile memory (NVM), for example, at least one disk memory.

[0170] The bus can be an industry standard architecture (ISA) bus, a peripheral component (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, the bus in the drawings of the present application does not limit only one bus or one type of bus.

[0171] The application further provides a computer program product applied to the browser client, comprising a computer program which, when executed by a processor, implements the method described above.

[0172] The application further provides a computer program product applied to the micro-service gateway, comprising a computer program which, when executed by a processor, implements the method described above.

[0173] The application further provides a computer readable storage medium applied to the browser client, wherein the computer readable storage medium stores computer execution instructions, and when a processor executes the computer execution instructions, the method described above is implemented.

[0174] The application further provides a computer readable storage medium applied to the micro-service gateway, wherein the computer readable storage medium stores computer execution instructions, and when a processor executes the computer execution instructions, the method described above is implemented.

[0175] The readable storage medium described above can be realized by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that a general-purpose or special-purpose computer can access.

[0176] The readable storage medium described above can be realized by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that a general-purpose or special-purpose computer can access.

[0177] An exemplary readable storage medium is coupled to the processor, so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in the device.

[0178] The division of units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0179] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, can be located in one place, or can be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0180] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.

[0181] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the part of the present application that essentially contributes to the prior art or the part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.

[0182] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware. The aforementioned program can be stored in a computer readable storage medium. The program executes the steps including the above-mentioned method embodiments when executed; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, and various program code storage media.

[0183] It should be understood that many of the materials and devices exemplified in this disclosure are articles of manufacture (i.e., articles of manufacture) according to this disclosure. The articles of manufacture can be employed as such to provide advantageous results. The articles of manufacture can also be employed in the practice or testing of the present disclosure. The articles of manufacture can also be employed in the practice or testing of other examples of the present disclosure. The articles of manufacture employed as such for practicing the present disclosure: include those devices and those manufacturing techniques that are known to those of skill in the art in this field. The articles of manufacture employed as such for practicing the present disclosure: include those devices and those manufacturing techniques that are analogous to those devices and those manufacturing techniques that are known to those of skill in the art in this field. The articles of manufacture employed as such for practicing the present disclosure: include those devices and those manufacturing techniques that are later developed by those of skill in the art in this field and are equivalent to those devices and those manufacturing techniques that are known to those of skill in the art in this field.

Claims

1. A request processing method characterized by comprising: The application is applied to a client browser, and comprises: initiating a first request in response to a user's page access request, wherein the first request is a hypertext transfer protocol request to be transmitted; obtaining a request header of the first request; determining whether the first request is a simple request; if the first request is not a simple request, performing special identification processing on the request header to obtain an identified request header; emptying the request header of the first request and adding the identified request header to a non-request header of the first request to obtain a second request, wherein the second request is a processed hypertext transfer protocol request; sending the second request to a micro-service gateway, so that the micro-service gateway restores the second request to the first request and sends the first request to a micro-service for request processing.

2. The method of claim 1, wherein, The emptying of the request header of the first request and the adding of the identified request header to the non-request header of the first request to obtain the second request comprises: emptying the request header of the first request; obtaining a uniform resource locator of the first request; adding the identified request header to the uniform resource locator of the first request to obtain the second request.

3. The method of claim 1, wherein, The special identification processing on the request header to obtain the identified request header comprises: obtaining a preset prefix; adding the preset prefix to the request header to obtain the identified request header.

4. The method according to any one of claims 1 to 3, characterized in that, The determination of whether the first request is a simple request comprises: obtaining a request method and a request header field of the first request; determining whether the first request is a simple request according to the request method and the request header field.

5. A request processing method characterized by comprising: The application is applied to a micro-service gateway, and comprises: receiving a second request sent by a client browser, wherein the second request is obtained after the client browser initiates a first request in response to a user's page access request, obtains a request header of the first request, determines whether the first request is a simple request, performs special identification processing on the request header to obtain an identified request header if the first request is not a simple request, and empties the request header of the first request and adds the identified request header to a non-request header of the first request, the first request is a hypertext transfer protocol request to be transmitted; restoring the second request to the first request; sending the first request to a micro-service for request processing.

6. The method of claim 5, wherein, The method according to claim 5, wherein the restoring of the second request to the first request comprises: identifying the identified request header according to a special identification; performing restoration processing on the identified request header to obtain the request header; adding the request header to a request header of the second request and deleting the identified request header from a non-request header of the second request to obtain the first request.

7. A request processing apparatus characterized by comprising: The application is applied to a client browser, and comprises: a first request initiation module configured to initiate a first request in response to a user's page access request, wherein the first request is a hypertext transfer protocol request to be transmitted; a request header obtaining module configured to obtain a request header of the first request; a determination module configured to determine whether the first request is a simple request; An identifying module is configured to perform special identifying processing on the request header to obtain an identified request header if the first request is not a simple request. A processing module is configured to empty the request header of the first request and add the identified request header to non-request header of the first request to obtain a second request, wherein the second request is a processed HTTP request. A first sending module is configured to send the second request to the micro-service gateway, so that the micro-service gateway restores the second request to the first request and sends the first request to a micro-service for request processing.

8. A request processing apparatus characterized by comprising: The micro-service gateway comprises: A receiving module is configured to receive a second request sent by a client browser, wherein the second request is obtained by the client browser in response to a user's access page request, initiation of a first request, acquisition of a request header of the first request, judgment of whether the first request is a simple request, special identifying processing on the request header if the first request is not a simple request, and addition of the identified request header to non-request header of the first request to obtain the second request, and the first request is an HTTP request to be transmitted. A restoring module is configured to restore the second request to the first request. A second sending module is configured to send the first request to a micro-service for request processing.

9. A request processing device characterized by comprising: The micro-service gateway comprises: A processor and a memory connected to the processor in communication; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to implement the method of any one of claims 1 to 4.

10. A request processing device characterized by comprising: The micro-service gateway comprises: A processor and a memory connected to the processor in communication; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to implement the method of any one of claims 5 or 6.

11. A computer readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the method of any one of claims 1 to 4.

12. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the method of claim 5 or 6.

13. A computer program product, characterised in that, The computer program is executed by the processor to implement the method of any one of claims 1 to 4.

14. A computer program product, characterised in that, The computer program is executed by the processor to implement the method of claim 5 or 6.

Citation Information

Patent Citations

  • Micro-service request processing method and device and storage medium

    CN112637289A

  • Automated identification of service boundaries based on system focus optimization using distributed tracing data

    US10855812B1