CN111385146A - API gateway routing entity configuration method and system based on Kong - Google Patents

API gateway routing entity configuration method and system based on Kong Download PDF

Info

Publication number
CN111385146A
CN111385146A CN202010145763.0A CN202010145763A CN111385146A CN 111385146 A CN111385146 A CN 111385146A CN 202010145763 A CN202010145763 A CN 202010145763A CN 111385146 A CN111385146 A CN 111385146A
Authority
CN
China
Prior art keywords
module
request
kong
configuration
api gateway
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010145763.0A
Other languages
Chinese (zh)
Inventor
刘清华
马浩严
赵阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Huimao Electronic Port Co Ltd
Original Assignee
Shandong Huimao Electronic Port Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Huimao Electronic Port Co Ltd filed Critical Shandong Huimao Electronic Port Co Ltd
Priority to CN202010145763.0A priority Critical patent/CN111385146A/en
Publication of CN111385146A publication Critical patent/CN111385146A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0889Techniques to speed-up the configuration process
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/14Routing performance; Theoretical aspects

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a Kong-based API gateway routing entity configuration method and a Kong-based API gateway routing entity configuration system, which belong to the field of communication configuration; the method comprises the following specific steps: s1 configuring the API gateway plug-in developed based on Kong by using the YAML configuration file; s2, limiting the fields in the request header in the entity; s3 fully matching the restriction field with the client request; s4 carrying out intelligent routing on the completely matched request; the client sends HTTP request to the gateway, the gateway receives the request, then the method of the invention is used for configuration of API gateway routing entity, the field in the request is limited, and the limited field is completely matched with the client request, thereby achieving the request of intelligent routing under the condition of multi-domain name analysis.

Description

API gateway routing entity configuration method and system based on Kong
Technical Field
The invention discloses a Kong-based API gateway routing entity configuration method and system, and relates to the technical field of communication configuration.
Background
The API economy is a brand-new economic phenomenon generated in the information networking era. An API Gateway (API Gateway) is an architectural model that is created together with a microservice architecture, and an enterprise can host an API through the API Gateway to open and use the API. The API gateway provides basic functions of intelligent routing and load balancing, and further provides functions of authentication, current limiting, monitoring and the like, and API management is performed through a unified gateway access, so that the problem that micro-service architectures are too dispersed is solved, and the hosting of the API is realized.
Specifically, the inventor finds that, when the present invention is implemented, the basic configuration of the routing entity using the API gateway cannot satisfy the intelligent routing of the request under the condition of analyzing a plurality of domain names, and the work efficiency of the request configuration is low, and the work requirement of the intelligent reason cannot be satisfied.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a method and a system for configuring an API gateway routing entity based on Kong, and the adopted technical scheme is as follows:
a configuration method of an API gateway routing entity based on Kong comprises the following specific steps:
s1 configuring the API gateway plug-in developed based on Kong by using the YAML configuration file;
s2, limiting the fields in the request header in the entity;
s3 fully matching the restriction field with the client request;
s4 intelligently routes the fully matched request.
The S1 declaratively configures API gateway plug-ins developed based on Kong using YAML configuration files.
The S2 implements restriction on fields in the request header in the entity by adding restrictions on the request headers on the base configuration.
The S3 exactly matches the restriction field with the HTTP request sent by the client.
The specific step of S3 completely matching the restriction field with the HTTP request sent by the client includes:
s301, the gateway judges whether a route completely matched with the request exists locally
S302, if no corresponding route exists locally, an error message is returned to the client.
The specific step of S4 includes:
s401, the gateway forwards the complete matching request message to an upstream server;
s402, the upstream server sends the response message to the gateway;
and S403, the gateway returns the response message to the client.
A kind of API gateway routing entity based on Kong disposes the system, said system includes disposing module, restriction module, matching module and routing module;
a configuration module: configuring an API gateway plug-in developed based on Kong by using a YAML configuration file;
a limiting module: limiting fields in a request header in an entity;
a matching module: completely matching the restriction field with the client request;
a routing module: the perfectly matched requests are intelligently routed.
The configuration module declaratively configures API gateway plug-ins developed based on Kong using YAML configuration files.
The restriction module implements restriction of fields in request headers in an entity by adding restrictions on request headers on the base configuration.
And the matching module is used for completely matching the restriction field with the HTTP request sent by the client.
The matching module comprises a judging module and a returning module:
a judging module: the gateway judges whether a route completely matched with the request exists locally by using a judging module;
a return module: and if the corresponding route does not exist locally, the return module returns error information to the client.
The routing module specifically comprises a forwarding module, a response module and a feedback module:
the gateway forwards the complete request message to an upstream server through a forwarding module;
the upstream server sends the response message to the gateway by using the response module;
the gateway returns the response message to the client by using the feedback module.
The invention has the beneficial effects that: the client sends HTTP request to the gateway, the gateway receives the request, then the method of the invention is used for configuration of API gateway routing entity, the field in the request is limited, and the limited field is completely matched with the client request, thereby achieving the request of intelligent routing under the condition of multi-domain name analysis.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a schematic representation of the steps of the process of the present invention; FIG. 2 is a schematic diagram of the system of the present invention; fig. 3 is a flow chart of the operation of the present invention.
Detailed Description
The present invention is further described below in conjunction with the following figures and specific examples so that those skilled in the art may better understand the present invention and practice it, but the examples are not intended to limit the present invention.
The first embodiment is as follows:
a method for configuring an API gateway routing entity based on Kong comprises the following specific steps:
s1 configuring the API gateway plug-in developed based on Kong by using the YAML configuration file;
s2, limiting the fields in the request header in the entity;
s3 fully matching the restriction field with the client request;
s4 carrying out intelligent routing on the completely matched request;
the client sends an HTTP request to the gateway, the gateway receives the request, then the method of the invention is used for configuration of an API gateway routing entity, fields in the request are limited through S2, and the limited fields are completely matched with the client request through S3, so that the request of intelligent routing is realized under the condition of multi-domain name resolution;
further, the S1 makes declarative configuration of API gateway plug-in developed based on Kong using YAML configuration file;
further, the S2 implements limitation on the field in the request header in the entity by adding limitation on the X-Forwarded-Host field in the request headers on the basis of the basic configuration:
Figure BDA0002400659120000041
further, the specific step of S3 completely matching the restriction field with the HTTP request sent by the client includes:
s301, the gateway judges whether a route completely matched with the request exists locally
S302, if no corresponding route exists locally, returning error information to the client;
still further, the step of S4 routing the completely matched request intelligently includes:
s401, the gateway forwards the complete matching request message to an upstream server;
s402, the upstream server sends the response message to the gateway;
and S403, the gateway returns the response message to the client. The intelligent routing of the request under the condition of meeting the resolution of a plurality of domain names can be realized.
Example two:
the invention also provides an API gateway routing entity configuration system based on Kong corresponding to the method, which comprises a configuration module, a limiting module, a matching module and a routing module;
a configuration module: configuring an API gateway plug-in developed based on Kong by using a YAML configuration file;
a limiting module: limiting fields in a request header in an entity;
a matching module: completely matching the restriction field with the client request;
a routing module: the perfectly matched requests are intelligently routed.
The client sends HTTP request to the gateway, the gateway receives the request, then the system of the invention is used for configuration of API gateway routing entity, the field in the request is limited by the limiting module, the limiting field is completely matched with the client request by the matching module, and the request of intelligent routing is realized under the condition of multi-domain name analysis;
further, the configuration module makes declarative configuration on the API gateway plug-in developed based on Kong by using YAML configuration files;
further, the restriction module adds restriction on the X-Forwarded-Host field in the request headers on the basis of the basic configuration to realize restriction on the field in the request header in the entity:
Figure BDA0002400659120000051
further, the matching module completely matches the restricted field with the HTTP request sent by the client, and the matching module includes a judging module and a returning module:
a judging module: the gateway judges whether a route completely matched with the request exists locally by using a judging module;
a return module: and if the corresponding route does not exist locally, the return module returns error information to the client.
Still further, the routing module specifically includes a forwarding module, a response module, and a feedback module:
the gateway forwards the complete request message to an upstream server through a forwarding module;
the upstream server sends the response message to the gateway by using the response module;
the gateway returns the response message to the client by using the feedback module.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A configuration method of API gateway routing entity based on Kong is characterized in that the method comprises the following steps:
s1 configuring the API gateway plug-in developed based on Kong by using the YAML configuration file;
s2, limiting the fields in the request header in the entity;
s3 fully matching the restriction field with the client request;
s4 intelligently routes the fully matched request.
2. The configuration method of the Kong based API gateway routing entity of claim 1, wherein the S1 declaratively configures the Kong based API gateway plug-in using YAML configuration file.
3. The Kong-based API gateway routing entity configuration method of claim 2, wherein the S2 implements restriction of fields in request headers in an entity by adding restrictions on request headers on a base configuration.
4. The Kong-based API gateway routing entity configuration method of claim 3, wherein the S3 matches the restriction field exactly with the HTTP request sent by the client.
5. The configuration method of API gateway routing entity based on Kong as claimed in claim 4, wherein said S4 specific steps include:
s401, the gateway forwards the complete matching request message to an upstream server;
s402, the upstream server sends the response message to the gateway;
and S403, the gateway returns the response message to the client.
6. A kind of API gateway routing entity based on Kong disposes the system, its characteristic is that the said system includes disposing the module, limiting module, matching module and route module;
a configuration module: configuring an API gateway plug-in developed based on Kong by using a YAML configuration file;
a limiting module: limiting fields in a request header in an entity;
a matching module: completely matching the restriction field with the client request;
a routing module: the perfectly matched requests are intelligently routed.
7. The Kong based API gateway routing entity configuration system of claim 6, wherein said configuration module declaratively configures the Kong based API gateway plug-in using YAML configuration files.
8. The Kong-based API gateway routing entity configuration method of claim 7, wherein the restriction module implements restriction of fields in request headers in an entity by adding restrictions on request headers on a base configuration.
9. The Kong based API gateway routing entity configuration system of claim 8, wherein the matching module matches the restriction field exactly with HTTP requests sent by clients.
10. The system of claim 9, wherein the routing module comprises a forwarding module, a response module, and a feedback module:
the gateway forwards the complete request message to an upstream server through a forwarding module;
the upstream server sends the response message to the gateway by using the response module;
the gateway returns the response message to the client by using the feedback module.
CN202010145763.0A 2020-03-05 2020-03-05 API gateway routing entity configuration method and system based on Kong Pending CN111385146A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010145763.0A CN111385146A (en) 2020-03-05 2020-03-05 API gateway routing entity configuration method and system based on Kong

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010145763.0A CN111385146A (en) 2020-03-05 2020-03-05 API gateway routing entity configuration method and system based on Kong

Publications (1)

Publication Number Publication Date
CN111385146A true CN111385146A (en) 2020-07-07

Family

ID=71222664

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010145763.0A Pending CN111385146A (en) 2020-03-05 2020-03-05 API gateway routing entity configuration method and system based on Kong

Country Status (1)

Country Link
CN (1) CN111385146A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111818158A (en) * 2020-07-08 2020-10-23 京东方科技集团股份有限公司 Gateway control method, device, electronic equipment and storage medium
CN114500517A (en) * 2022-03-14 2022-05-13 北京计算机技术及应用研究所 Method for realizing control file uploading based on API gateway

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180322136A1 (en) * 2017-05-05 2018-11-08 Esoptra NV Plug-in function platform and methods
CN109639572A (en) * 2018-12-06 2019-04-16 网易(杭州)网络有限公司 Route management method, device and micro services system
CN110753127A (en) * 2019-10-29 2020-02-04 浪潮云信息技术有限公司 Method for realizing request parameter conversion based on Kong API gateway
CN110784360A (en) * 2019-11-01 2020-02-11 浪潮云信息技术有限公司 Method and system for realizing Kong declarative configuration hot update

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180322136A1 (en) * 2017-05-05 2018-11-08 Esoptra NV Plug-in function platform and methods
CN109639572A (en) * 2018-12-06 2019-04-16 网易(杭州)网络有限公司 Route management method, device and micro services system
CN110753127A (en) * 2019-10-29 2020-02-04 浪潮云信息技术有限公司 Method for realizing request parameter conversion based on Kong API gateway
CN110784360A (en) * 2019-11-01 2020-02-11 浪潮云信息技术有限公司 Method and system for realizing Kong declarative configuration hot update

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
腾讯云云+社区成员: ""X-Forwarded-Host"", 《腾讯云云+社区》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111818158A (en) * 2020-07-08 2020-10-23 京东方科技集团股份有限公司 Gateway control method, device, electronic equipment and storage medium
CN114500517A (en) * 2022-03-14 2022-05-13 北京计算机技术及应用研究所 Method for realizing control file uploading based on API gateway

Similar Documents

Publication Publication Date Title
US11411897B2 (en) Communication method and communication apparatus for message queue telemetry transport
US6546420B1 (en) Aggregating information about network message flows
US7069318B2 (en) Content tracking in transient network communities
CN101088245B (en) Performing security functions on a message payload in a network element
US7143139B2 (en) Broadcast tiers in decentralized networks
US8090839B2 (en) XML message validation in a network infrastructure element
US7251689B2 (en) Managing storage resources in decentralized networks
US8176189B2 (en) Peer-to-peer network computing platform
US7769871B2 (en) Technique for sending bi-directional messages through uni-directional systems
US20120089677A1 (en) Method and system for providing network services
US8935386B2 (en) Network topology
CN101729491B (en) Method, device and system for enhancing application reliability of script-based business
US11005736B2 (en) Determining traceability of network traffic over a communications network
JP2021516024A (en) Determining traceability of network traffic over communication networks
EP1491026B1 (en) Dynamic addressing in transient networks
WO2023000940A1 (en) Data processing method and apparatus, and network element device, storage medium and program product
CN111385146A (en) API gateway routing entity configuration method and system based on Kong
US11575656B1 (en) Customer data handling in a proxy infrastructure
CN102932269A (en) Method and device for balancing load
US20060007942A1 (en) Method for finding resource and service in network and relay node apparatus
EP2864903A1 (en) Dynamic input streams handling in dsms
US8862095B2 (en) Managing mobile nodes in a lawful intercept architecture
Srirama et al. Mobile hosts in enterprise service integration
Moritz et al. Devices profile for web services in wireless sensor networks: Adaptations and enhancements
CN111600929B (en) Transmission line detection method, routing strategy generation method and proxy server

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20200707

WD01 Invention patent application deemed withdrawn after publication