<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jing Yan</title>
    <description>The latest articles on DEV Community by Jing Yan (@jyan00).</description>
    <link>https://dev.to/jyan00</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1256736%2F4cd38f4b-1a81-4445-8324-87462d2813a2.jpeg</url>
      <title>DEV Community: Jing Yan</title>
      <link>https://dev.to/jyan00</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jyan00"/>
    <language>en</language>
    <item>
      <title>Protecting Your APIs in the Wild: A Deep Dive into WAF and API Gateway Integration</title>
      <dc:creator>Jing Yan</dc:creator>
      <pubDate>Tue, 30 Jan 2024 09:36:28 +0000</pubDate>
      <link>https://dev.to/apisix/protecting-your-apis-in-the-wild-a-deep-dive-into-waf-and-api-gateway-integration-56an</link>
      <guid>https://dev.to/apisix/protecting-your-apis-in-the-wild-a-deep-dive-into-waf-and-api-gateway-integration-56an</guid>
      <description>&lt;p&gt;In today's digital age, APIs have become an integral part of our daily lives. They allow us to access and exchange data between different applications and services. However, with the increasing number of API endpoints exposed to the public, there is an ever-growing risk of cyberattacks and data breaches. This is why it is crucial to implement robust security measures to protect your APIs from malicious attacks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Integrating WAF and API Gateway for API Protection
&lt;/h2&gt;

&lt;p&gt;Web Application Firewall (WAF) and API Gateway technologies are two of the most effective ways to secure APIs from attacks. A WAF is a security solution that sits between the internet and your API server, analyzing incoming requests and blocking any malicious traffic. On the other hand, an API Gateway is a middleware layer that sits between your API server and the client, managing access control, traffic routing, and rate limiting.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api7.ai/apisix"&gt;Apache APISIX&lt;/a&gt;, a popular open-source API gateway, offers a robust set of built-in security plugins. However, in the face of increasingly sophisticated attacks like CVEs (Common Vulnerabilities and Exposures) and zero-day exploits, relying solely on these plugins can leave your APIs vulnerable. Integrating a professional Web Application Firewall (WAF) with APISIX provides a multi-layered defense strategy, ensuring comprehensive protection against modern threats.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding APISIX's Security Capabilities
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Authentication and Authorization: APISIX supports plugins for &lt;a href="https://docs.api7.ai/hub/jwt-auth"&gt;&lt;code&gt;JWT&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://docs.api7.ai/cloud/references/plugins/traffic-management/authentication#basic-auth"&gt;&lt;code&gt;basic auth&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://docs.api7.ai/hub/key-auth"&gt;&lt;code&gt;key auth&lt;/code&gt;&lt;/a&gt;, and integration with &lt;a href="https://docs.api7.ai/hub/openid-connect"&gt;OpenID Connect&lt;/a&gt; providers, enforcing access control.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rate Limiting: Prevents malicious traffic spikes and DoS attacks through plugins like &lt;a href="https://docs.api7.ai/enterprise-whitepaper/features/plugins#traffic-control"&gt;&lt;code&gt;limit-conn&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://docs.api7.ai/hub/limit-req"&gt;&lt;code&gt;limit-req&lt;/code&gt;&lt;/a&gt;, and &lt;a href="https://docs.api7.ai/hub/limit-count"&gt;&lt;code&gt;limit-count&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;IP Restriction and User-Agent Filtering: Allow granular control over incoming requests based on IP addresses and user agents.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CSRF Protection: Thwarts Cross-Site Request Forgery attacks.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Limitations of API Gateway
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Signature-Based Detection: APISIX plugins primarily rely on known attack signatures, leaving them ineffective against zero-day exploits that lack defined patterns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lack of Rule Updates: Security rules are constantly changing, which requires professional security experts and companies to maintain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Limited Scope: While APISIX safeguards the gateway layer, WAFs provide broader protection across application layers.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Benefits of WAF and API Gateway Integration
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Proactive Threat Detection: Advanced WAFs leverage machine learning and behavioral analysis to detect anomalous traffic, even without prior knowledge of vulnerabilities.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Real-Time Rule Updates: Cloud-based WAFs can quickly update rules to address emerging threats, minimizing exposure windows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Deeper Application Protection: WAFs can filter and block malicious traffic at the application layer, shielding against attacks that bypass API gateways.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compliance and Regulatory Adherence: Certain industries mandate WAF usage for compliance with data security regulations.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Deep Dive into the Integration Process
&lt;/h2&gt;

&lt;p&gt;To integrate WAF and API Gateway, you need to choose the right tools for the job. Apache APISIX is a popular API Gateway solution that provides a scalable and flexible platform for managing your APIs. &lt;a href="https://github.com/chaitin/SafeLine"&gt;Chaitin SafeLine&lt;/a&gt; and &lt;a href="https://coraza.io/"&gt;Coraza&lt;/a&gt; are the WAF solutions that offer advanced security features and customizable rule sets.&lt;/p&gt;

&lt;h3&gt;
  
  
  APISIX and Chaitin SafeLine
&lt;/h3&gt;

&lt;p&gt;The Chaitin SafeLine WAF is a built-in plugin from APISIX 3.5. After the &lt;code&gt;chaitin-waf&lt;/code&gt; plug-in is enabled, traffic will be forwarded to the Chaitin WAF service to detect and prevent various web application attacks to protect the security of applications and user data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jNbvNPLY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/23/Sy8ac32t_WAF_APISIX_1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jNbvNPLY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/23/Sy8ac32t_WAF_APISIX_1.png" alt="WAF_APISIX_1" width="800" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Assuming that you have installed Apache APISIX and SafeLine, the following command line can integrate the two:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://127.0.0.1:9180/apisix/admin/plugin_metadata/chaitin-waf &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1'&lt;/span&gt; &lt;span class="nt"&gt;-X&lt;/span&gt; PUT &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'
{
  "nodes":[
     {
       "host": "192.168.99.11",
       "port": 8000
     }
  ]
}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;192.168.99.11 is the ip of the SafeLine service. Then we can create a route in APISIX:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://127.0.0.1:9180/apisix/admin/routes/1 &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1'&lt;/span&gt; &lt;span class="nt"&gt;-X&lt;/span&gt; PUT &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'
{
   "uri": "/*",
   "plugins": {
       "chaitin-waf": {}
    },
   "upstream": {
       "type": "roundrobin",
       "nodes": {
           "192.168.99.12:80": 1
       }
   }
}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;192.168.99.12 is the ip of the upstream service. The integration is complete.&lt;/p&gt;

&lt;p&gt;Now let’s simulate SQL injection to see the effect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://127.0.0.1:9080 &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'a=1 and 1=1'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An HTTP 403 error was returned, and as can be seen from the error message, Chaitin SafeLine successfully defended against the attack.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"code"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;403&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"success"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"blocked by Chaitin SafeLine Web Application Firewall"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nl"&gt;"event_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"18e0f220f7a94127acb21ad3c1b4ac47"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  APISIX and Coraza-proxy-wasm
&lt;/h3&gt;

&lt;p&gt;APISIX supports developing plugins with WebAssembly (&lt;a href="https://api7.ai/blog/how-apisix-supports-wasm"&gt;Wasm&lt;/a&gt;), and &lt;a href="https://docs.api7.ai/apisix/how-to-guide/security/waf/integrate-with-coraza"&gt;Coraza&lt;/a&gt; also provides Wasm plugins as an option. Therefore, integrating Coraza with APISIX incurs relatively low costs.&lt;/p&gt;

&lt;p&gt;Wasm can be utilized cross-platform, allowing APISIX and Coraza to work without additional extensive modifications or adaptations. This eliminates extensive code modifications and adaptations.&lt;/p&gt;

&lt;p&gt;Coraza is also a built-in plug-in of Apache APISIX, which can be enabled by modifying the configuration &lt;code&gt;file conf/config-default.yaml&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wasm:
  plugins:
    - name: coraza-filter
      priority: 7999
      file: /home/ubuntu/coraza-proxy-wasm/build/main.wasm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then create a route in APISIX with the rules of Coraza:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-i&lt;/span&gt; http://127.0.0.1:9180/apisix/admin/routes/1 &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1'&lt;/span&gt; &lt;span class="nt"&gt;-X&lt;/span&gt; PUT &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{
  "uri": "/anything",
  "plugins": {
    "coraza-filter": {
      "conf": {
        "directives_map": {
          "default": [
            "SecDebugLogLevel 9",
            "SecRuleEngine On",
            "SecRule REQUEST_URI \"@beginsWith /anything\" \"id:101,phase:1,t:lowercase,deny\""
          ]
        },
        "default_directives": "default"
      }
    }
  },
  "upstream": {
    "type": "roundrobin",
    "nodes": {
      "httpbin.org:80": 1
    }
  }
}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's send a request to see the effect:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://localhost:9080/anything &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check logs in&lt;code&gt;logs/error.log&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;2023/08/31 09:20:39 &lt;span class="o"&gt;[&lt;/span&gt;info] 126240#126240: &lt;span class="k"&gt;*&lt;/span&gt;23933 Transaction interrupted &lt;span class="nv"&gt;tx_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"JVhHVfDuGjVbfgvDjik"&lt;/span&gt; &lt;span class="nv"&gt;context_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2 &lt;span class="nv"&gt;action&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"deny"&lt;/span&gt; &lt;span class="nv"&gt;phase&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"http_request_headers"&lt;/span&gt;, client: 127.0.0.1, server: _, request: &lt;span class="s2"&gt;"GET /anything HTTP/1.1"&lt;/span&gt;, host: &lt;span class="s2"&gt;"localhost:9080"&lt;/span&gt;
2023/08/31 09:20:39 &lt;span class="o"&gt;[&lt;/span&gt;debug] 126240#126240: &lt;span class="k"&gt;*&lt;/span&gt;23933 Interruption already handled, sending downstream the &lt;span class="nb"&gt;local &lt;/span&gt;response &lt;span class="nv"&gt;tx_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"JVhHVfDuGjVbfgvDjik"&lt;/span&gt; &lt;span class="nv"&gt;context_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2 &lt;span class="nv"&gt;interruption_handled_phase&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"http_request_headers"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Best Practices for Securing APIs Using WAF and API Gateway Integration
&lt;/h2&gt;

&lt;p&gt;To ensure the security of your APIs, you should follow these best practices:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Implement a defense-in-depth strategy that includes multiple layers of security controls;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use SSL/TLS encryption to secure data in transit;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Regularly update your WAF rule sets to ensure they are up-to-date with the latest threats;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Monitor your API traffic and logs to quickly detect and respond to security incidents.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Future Trends and Advancements in API Security and Protection
&lt;/h2&gt;

&lt;p&gt;As the number of APIs in use grows, there will be a greater need for advanced security measures to protect them. Some of the future trends and advancements in API security and protection include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;AI-powered security solutions that can detect and respond to threats automatically;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Blockchain-based authentication and access control mechanisms;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Microservices-based API architectures that offer greater flexibility and scalability.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;In conclusion, WAF and API Gateway integration is a critical component of API security. By following best practices and deploying the right tools, you can create a robust security layer that protects your APIs from a wide range of attacks. With the right approach, you can ensure the availability, integrity, and confidentiality of your APIs and the data they exchange.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How Does APISIX Bridge the Gap Between DMZ and the Internal Networks?</title>
      <dc:creator>Jing Yan</dc:creator>
      <pubDate>Sun, 28 Jan 2024 12:01:46 +0000</pubDate>
      <link>https://dev.to/apisix/how-does-apisix-bridge-the-gap-between-dmz-and-the-internal-networks-1pp7</link>
      <guid>https://dev.to/apisix/how-does-apisix-bridge-the-gap-between-dmz-and-the-internal-networks-1pp7</guid>
      <description>&lt;p&gt;DMZ, or Demilitarized Zone, serves as a secure network zone strategically positioned between the internal and external networks (commonly the Internet). It acts as a safeguard for hosting services or resources that are not entirely trusted, thereby fortifying overall network security. Its core objective is to segregate communication between the internal network, often containing sensitive data and resources, and the external network. Simultaneously, it accommodates services or applications requiring interaction with the external network.&lt;/p&gt;

&lt;p&gt;Within the DMZ, one can deploy public servers (e.g., web servers, mail servers, DNS servers) or proxy servers. These servers engage in communication with the external network but do not necessitate direct access to internal network resources. Placing these public services in the DMZ effectively reduces the risk to the internal network. Even if attackers breach the DMZ, they encounter additional hurdles to access sensitive internal network data.&lt;/p&gt;

&lt;p&gt;To facilitate secure access between the DMZ and the internal network, APISIX can be utilized to conveniently manage API calls. Two application scenarios (in the manufacturing and finance sectors) will be presented below.&lt;/p&gt;

&lt;h2&gt;
  
  
  Scenario One: A Mobile Phone Manufacturer
&lt;/h2&gt;

&lt;p&gt;DMZ: Open to the external network;&lt;/p&gt;

&lt;p&gt;General Zone: Completely isolated from the external network, neither able to access nor be accessed by the external network.&lt;/p&gt;

&lt;p&gt;The existing gateway system is not a mere north-south traffic gateway; rather, it integrates both north-south and east-west traffic.&lt;/p&gt;

&lt;p&gt;Traffic requests primarily manifest in the following four scenarios:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Classic North-South: External network traffic traverses the DMZ gateway, then is routed to the General Zone gateway within the local domain, eventually reaching backend services.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inter-domain Forwarding: External network traffic navigates through the DMZ gateway, realizing that the backend service is located outside the local domain. It traverses the internal backbone network to reach the General Zone gateway within the backend's domain before finally reaching the backend service.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;East-West: A backend application (Region A) calls an interface of another application (Region B) (depicted here as a cross-domain invocation scenario). After passing through the gateway in the General Zone of the application (Region A), it is forwarded to the gateway in the General Zone of the application (Region B) before reaching the corresponding application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Calling External Network Services: Backend services require access to third-party services (Taobao, JD, SF Express, etc.). After passing through the local General Zone gateway, the request is forwarded to the DMZ gateway and subsequently directed to the third-party service.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TxuvkUrU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/25/9TP5r4hc_DMZ_1_ENG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TxuvkUrU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/25/9TP5r4hc_DMZ_1_ENG.png" alt="DMZ_1_ENG" width="800" height="523"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Scenario Two: A Financial Firm
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X_Amgf-0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/27/IKrWLbjU_DMZ_2_ENG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X_Amgf-0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/27/IKrWLbjU_DMZ_2_ENG.png" alt="DMZ_2_ENG" width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Production External Network DMZ: Open to the external network;&lt;/p&gt;

&lt;p&gt;Production Internal Network: Completely isolated from the external network, and all traffic must pass through the gateway for management.&lt;/p&gt;

&lt;p&gt;The customer's primary objectives with APISIX revolve around addressing the following key aspects:&lt;/p&gt;

&lt;p&gt;Supervisory Needs: To comply with regulatory standards, the customer seeks the ability to thoroughly record and audit all microservices calls when accessing internal services over the external network.&lt;/p&gt;

&lt;p&gt;Robust Service Management: Ensuring stringent authentication and implementing traffic throttling measures for each microservice module is a crucial aspect of the customer's service management requirements.&lt;/p&gt;

&lt;p&gt;Business Growth: The customer aims to resolve challenges in business expansion, particularly addressing the need for inter-microservices communication across different business domains or teams.&lt;/p&gt;

&lt;p&gt;Holistic Management: As the number of microservices grows, the customer acknowledges the need to address the significant impact of increasing call chain complexity on overall business stability.&lt;/p&gt;

&lt;p&gt;Future Prospects: Looking ahead to the cloudification transformation of applications, the customer highlights the pivotal role of a service gateway in driving the process of application cloudification.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;To sum up, the DMZ plays a pivotal role in network security, acting as a barrier between internal and external networks. Its function is to safeguard sensitive data and resources while facilitating essential external interactions. Utilizing contemporary gateway systems and &lt;a href="https://api7.ai/enterprise"&gt;API management tools&lt;/a&gt; enhances the efficient management and security of network traffic, addressing the security and regulatory needs across diverse industries. Whether for a mobile phone manufacturer or a financial institution, employing these technologies ensures network security and operational stability, while also meeting the demands of future development.&lt;/p&gt;

&lt;p&gt;To find out more about API management solutions, you can contact &lt;a href="https://api7.ai/"&gt;API7.ai&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How Does API7 Enterprise Proxy Applications in Kubernetes Clusters?</title>
      <dc:creator>Jing Yan</dc:creator>
      <pubDate>Wed, 24 Jan 2024 09:58:25 +0000</pubDate>
      <link>https://dev.to/apisix/how-does-api7-enterprise-proxy-applications-in-kubernetes-clusters-1jj8</link>
      <guid>https://dev.to/apisix/how-does-api7-enterprise-proxy-applications-in-kubernetes-clusters-1jj8</guid>
      <description>&lt;p&gt;In the dynamic era of cloud-native technologies, &lt;a href="https://api7.ai/solutions/vm-to-kubernetes" rel="noopener noreferrer"&gt;Kubernetes&lt;/a&gt; has emerged as the go-to solution for many enterprises seeking to build resilient and scalable applications. &lt;a href="https://api7.ai/enterprise" rel="noopener noreferrer"&gt;API7 Enterprise&lt;/a&gt; offers powerful capabilities in security and traffic management, coupled with exceptional performance. API7 Enterprise integrates with the Kubernetes Service Discovery, serving as a proxy for applications deployed within a Kubernetes cluster. Let's go exploring the process of utilizing API7 Enterprise to proxy applications in your Kubernetes cluster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Install &lt;a href="https://api7.ai/try?product=enterprise" rel="noopener noreferrer"&gt;API7 Enterprise&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: If API7 Enterprise is not already deployed within Kubernetes clusters, configure the network settings of the machine hosting API7 EE to ensure accessibility to upstream pods in the Kubernetes environment.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Deploy Services in Kubernetes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you've already deployed services in Kubernetes, you can skip this step. Otherwise, execute the following command to create services:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="c"&gt;# create a new namespace&lt;/span&gt;
   kubectl create namespace api7ee

   kubectl create deployment httpbin &lt;span class="nt"&gt;--image&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kennethreitz/httpbin:latest &lt;span class="nt"&gt;-n&lt;/span&gt; api7ee
   kubectl create service clusterip httpbin &lt;span class="nt"&gt;--tcp&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;80:80 &lt;span class="nt"&gt;-n&lt;/span&gt; api7ee
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create a Kubernetes Service Account&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;API7 Enterprise relies on this credential for accessing the Kubernetes API and fetching upstream configurations. Consequently, We need to create an &lt;code&gt;RBAC&lt;/code&gt; resource first. The following is the specific &lt;code&gt;YAML&lt;/code&gt; file configuration:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;  &lt;span class="c1"&gt;# rbac.yaml&lt;/span&gt;
  &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterRole&lt;/span&gt;
  &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api7-k8s-sd-watcher&lt;/span&gt;
  &lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;apiGroups&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;endpoints"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;verbs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;list"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;watch"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="s"&gt;---&lt;/span&gt;
  &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rbac.authorization.k8s.io/v1&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterRoleBinding&lt;/span&gt;
  &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api7-k8s-sd-watcher-binding&lt;/span&gt;
  &lt;span class="na"&gt;subjects&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ServiceAccount&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api7-k8s-sd-sa&lt;/span&gt;
      &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api7ee&lt;/span&gt;
  &lt;span class="na"&gt;roleRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ClusterRole&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api7-k8s-sd-watcher&lt;/span&gt;
    &lt;span class="na"&gt;apiGroup&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rbac.authorization.k8s.io&lt;/span&gt;
  &lt;span class="s"&gt;---&lt;/span&gt;
  &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ServiceAccount&lt;/span&gt;
  &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api7-k8s-sd-sa&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api7ee&lt;/span&gt;
  &lt;span class="s"&gt;---&lt;/span&gt;
  &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
  &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Secret&lt;/span&gt;
  &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api7-k8s-sd-secret&lt;/span&gt;
    &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api7ee&lt;/span&gt;
    &lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;kubernetes.io/service-account.name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;api7-k8s-sd-sa&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kubernetes.io/service-account-token&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;ul&gt;
&lt;li&gt;Create RBAC resources and get this token.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Shell
   kubectl apply -f rbac.yaml -n api7ee
   kubectl get secrets api7-k8s-sd-secret -n api7ee -ojsonpath='{.data.token}' | base64 -d


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Implementation of Kubernetes Service Discovery in API7 Enterprise
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Connecting to the Kubernetes Service Registry
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to an existing gateway group and access the &lt;strong&gt;Service Registry&lt;/strong&gt; through the left-hand menu.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click the &lt;strong&gt;Add Service Registry Connection&lt;/strong&gt; button. Select Kubernetes as the discovery type and provide the Kubernetes API service access address and token.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.apiseven.com%2Fuploads%2F2024%2F01%2F22%2Fm9FEZeDl_PA_1_ENG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.apiseven.com%2Fuploads%2F2024%2F01%2F22%2Fm9FEZeDl_PA_1_ENG.png" alt="PA_1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Once API7 Enterprise establishes a successful connection to the service registry, you will see a healthy status.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.apiseven.com%2Fuploads%2F2024%2F01%2F22%2F5Lgtl9VN_PA_2_ENG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.apiseven.com%2Fuploads%2F2024%2F01%2F22%2F5Lgtl9VN_PA_2_ENG.png" alt="PA_2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Publishing the Service for Testing
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Navigate to the service page, click to create a new service, and add the &lt;code&gt;/anything&lt;/code&gt; route.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Proceed to publish the service, and choose the appropriate upstream:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.apiseven.com%2Fuploads%2F2024%2F01%2F22%2Fz3v00kUZ_PA_3_ENG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.apiseven.com%2Fuploads%2F2024%2F01%2F22%2Fz3v00kUZ_PA_3_ENG.png" alt="PA_3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;After publishing, you can test it using &lt;code&gt;curl&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;In conclusion, we have talked about the steps to leverage the API7 Enterprise for proxying Kubernetes services. For more information about the features of the &lt;a href="https://api7.ai/enterprise" rel="noopener noreferrer"&gt;API7 Enterprise&lt;/a&gt;, please don't hesitate to &lt;a href="https://calendly.com/api7" rel="noopener noreferrer"&gt;get in touch with us&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Methods for Retrieving the Client Source IP</title>
      <dc:creator>Jing Yan</dc:creator>
      <pubDate>Thu, 18 Jan 2024 07:41:28 +0000</pubDate>
      <link>https://dev.to/apisix/methods-for-retrieving-the-client-source-ip-5hef</link>
      <guid>https://dev.to/apisix/methods-for-retrieving-the-client-source-ip-5hef</guid>
      <description>&lt;p&gt;In certain situations, our services require using the client IP for specific business or security reasons. However, the usual scenario involves the traffic passing through multiple networks, load balancers, or proxy services before reaching the actual service. At each layer of this process, the original client IP may be lost, leaving our service with only the IP of the preceding network. This outcome is not ideal for us.&lt;/p&gt;

&lt;p&gt;Due to the intricate nature of our technology stack, obtaining the client IP involves employing various methods, sometimes in combination.&lt;/p&gt;

&lt;h2&gt;
  
  
  Managing Client IP via NAT
&lt;/h2&gt;

&lt;p&gt;In certain IDC infrastructures established or leased by users, our services may reside in a separate LAN network behind a gateway. When clients attempt to connect to our services from an external network, the traffic is routed through the gateway.&lt;/p&gt;

&lt;p&gt;A similar scenario may arise when utilizing cloud services. The VPC network provided by public cloud platforms functions as an independent LAN network, isolated from other VPCs and the internet. As a result, a gateway is required to facilitate external internet access and connect to external services.&lt;/p&gt;

&lt;p&gt;This gateway, which could be a router or firewall device, typically offers DNAT (Destination NAT) address translation services for internal services. This involves the gateway holding one or more public IP addresses and forwarding traffic from specific ports on the public IP to specific ports on an internal IP. The gateway manages traffic forwarding and port mapping. However, due to the modification of the source address in the original IP packet header by the gateway, our services within the internal network can only identify the gateway's IP address, not the actual client address.&lt;/p&gt;

&lt;p&gt;Historically, DNAT capabilities provided by network devices or software were relatively basic. They operated mainly at layer 3 and lacked awareness and manipulation capabilities for deeper-layer payloads. Their primary purpose was service exposure, and they couldn't pass the client IP downstream. Additionally, due to the performance limitations of these devices or software, there were constraints on the number of active connections and the maximum number of new connections they could handle. Scaling without hardware upgrades was often challenging, making them less adaptable to the dynamic environment of today.&lt;/p&gt;

&lt;p&gt;To address these limitations, we turn to load balancing, which possesses more advanced traffic manipulation capabilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Client IP in Load Balancing
&lt;/h2&gt;

&lt;p&gt;In general, load balancing is primarily categorized into two types based on their working layer: layer 4 and layer 7, corresponding to TCP data streams and application traffic (represented by HTTP), respectively.&lt;/p&gt;

&lt;p&gt;Differing from IP gateways, load balancing refrains from modifying the IP packet header. At the IP packet level, it solely engages in transparent forwarding. Consequently, in contrast to the previously discussed DNAT, load balancing ensures the correct passage of the source IP contained in the IP packet to the components behind the load balancer.&lt;/p&gt;

&lt;p&gt;For layer 4 load balancing, after accomplishing fundamental traffic forwarding, subsequent services can accurately retrieve the client IP without necessitating any special processing. In exceptional scenarios, it can leverage &lt;a href="https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt"&gt;Proxy Protocol&lt;/a&gt;. This involves appending a new section before the original traffic payload, encompassing the client IP. Other reverse proxy servers or the service itself behind the load balancer can then interpret Proxy Protocol data to obtain the client IP.&lt;/p&gt;

&lt;p&gt;For layer 7 load balancing, it possesses more profound traffic processing capabilities. It can directly convey the source IP at the HTTP protocol level. A prevalent approach is the utilization of the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For"&gt;X-Forwarded-For HTTP header&lt;/a&gt;. The load balancing component extracts the source IP from the IP packet of the traffic, subsequently parsing and rewriting the HTTP request. It inserts a new XFF field in its request header, incorporating the client IP value.&lt;/p&gt;

&lt;p&gt;HTTPS presents a particular challenge due to its encrypted payload, rendering the load balancing component unable to directly manipulate its HTTP headers. In such situations, the following approaches can be considered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Without specific requirements, treating HTTPS traffic as standard TLS traffic and forwarding it directly at layer 4 is an option. In this scenario, the client IP can still be transmitted to the service behind the load balancer through the IP packet header.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When layer 7 functionality is necessary, hosting the TLS certificate on the load balancing component enables TLS termination. This process involves removing TLS encryption at the load balancing layer, utilizing plain HTTP on the LAN behind the load balancer, or establishing a new HTTPS connection to the service instead of direct forwarding. This allows the load balancing component to once again handle the original HTTP traffic and continue passing the IP using the XFF method.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Through nuanced traffic handling, load balancing offers various methods to convey the client IP to the backend service. Representative implementations of load balancing components include cloud-based ELB services, hardware-based F5 BIG-IP, Linux Virtual Server (LVS) based on the Linux kernel, and user-software-based NGINX.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---VU32zdk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/17/k9xI1lX6_ClientIP_1.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---VU32zdk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/17/k9xI1lX6_ClientIP_1.jpg" alt="Client_IP_1" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Transmission of Client IP in CDN Services
&lt;/h3&gt;

&lt;p&gt;Occasionally, we leverage CDN services provided by public cloud platforms to enhance the speed of user access to our services. Their functioning is akin to a layer 7 reverse proxy server, but in a broader context, CDNs can be considered part of the load-balancing domain.&lt;/p&gt;

&lt;p&gt;CDN services typically provide TLS termination capabilities and can incorporate the client IP in HTTP requests sent to the service. For instance, AWS CloudFront CDN service supports &lt;a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html#RequestCustomIPAddresses"&gt;passing the client IP using the XFF method&lt;/a&gt;, resembling the approach used in layer 7 load balancing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Utilization of API Gateway
&lt;/h2&gt;

&lt;p&gt;While load balancing components typically offer basic control capabilities for traffic, the APIs provided by cloud-based or hardware load balancers can be challenging to align with our specific business needs. In such scenarios, we turn to more adaptable components to apply tailored strategies to our services. This is where an API gateway, like &lt;a href="https://api7.ai/apisix"&gt;Apache APISIX&lt;/a&gt; or &lt;a href="https://api7.ai/enterprise"&gt;API7 Enterprise&lt;/a&gt;, comes into play.&lt;/p&gt;

&lt;p&gt;APISIX and API7 Enterprise support the Proxy Protocol, enabling the retrieval of the client IP from the load balancer.&lt;/p&gt;

&lt;p&gt;Moreover, they feature a plugin named "real-ip," akin to NGINX's ngx_http_realip_module. This plugin fetches the client's IP from a source and uses it for downstream transmission and logging. The real-ip plugin on APISIX and API7 Enterprise enhances the functionality found on NGINX. It allows for dynamic activation or deactivation of the real source IP feature and expands the sources of client IP beyond the constraints of ngx_http_realip_module, which is limited to HTTP headers and Proxy Protocol. It can leverage any NGINX or APISIX extended variable, such as query parameters or POST form fields.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dMupSoPw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/17/kAUIHSDA_ClientIP_2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dMupSoPw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/17/kAUIHSDA_ClientIP_2.jpg" alt="Client_IP_2" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;By leveraging a combination of technologies at different layers, we can effectively pass the client IP through each component of the service, serving both business and security needs.&lt;/p&gt;

&lt;p&gt;To learn more about API management solutions, contact &lt;a href="https://api7.ai/"&gt;API7.ai&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>RBAC: Enabling Precise Permission Control for Enterprise APIs</title>
      <dc:creator>Jing Yan</dc:creator>
      <pubDate>Wed, 17 Jan 2024 01:28:22 +0000</pubDate>
      <link>https://dev.to/apisix/rbac-enabling-precise-permission-control-for-enterprise-apis-4b7j</link>
      <guid>https://dev.to/apisix/rbac-enabling-precise-permission-control-for-enterprise-apis-4b7j</guid>
      <description>&lt;p&gt;In the era of digitization, the IT architecture of enterprises is growing in complexity. APIs (Application Programming Interfaces), acting as vital connectors for interactions between internal and external systems, emphasize the critical importance of their security, availability, and manageability. To adeptly handle these APIs, Role-Based Access Control (RBAC) policies have become a widely adopted approach in enterprise permission management. &lt;a href="https://api7.ai/"&gt;API7&lt;/a&gt;, a leading API management platform, provides enterprises with an effective and flexible permission management solution through its refined RBAC strategies.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is RBAC?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/rbac-with-api-gateway-opa"&gt;RBAC&lt;/a&gt;, or Role-Based Access Control, stands as a prevalent strategy in access control. It links permissions to roles rather than directly to users. This implies that permissions are allocated to roles, and roles are subsequently assigned to users. Through this method, enterprises can effortlessly regulate different users' access to diverse resources.&lt;/p&gt;

&lt;p&gt;The fundamental strength of the RBAC policy lies in its streamlining of the permission management process. Enterprises are no longer burdened with the task of individually assigning permissions to each user; instead, they simply assign permissions to roles and then allocate users to the relevant roles. This not only amplifies management efficiency but also diminishes the risk of errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  RBAC in API7
&lt;/h2&gt;

&lt;p&gt;Within &lt;a href="https://api7.ai/enterprise"&gt;API7 Enterprise Edition&lt;/a&gt;, the RBAC implementation has undergone further enhancements and extensions, aligning it more closely with the actual requirements of enterprises. The RBAC functionality in API7 is detailed as follows:&lt;/p&gt;

&lt;h3&gt;
  
  
  Role Division
&lt;/h3&gt;

&lt;p&gt;API7 Enterprise Edition offers a variety of pre-defined roles, each equipped with distinct permissions and responsibilities. These roles encompass Super Administrator, API Provider, Runtime Administrator, Viewer, and others. Enterprises have the flexibility to assign different roles to various users according to their specific needs, enabling precise control over their access permissions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Super Administrator:&lt;/strong&gt; The role with the highest platform authority, capable of executing all operations, such as managing users, assigning permissions, and configuring the system. They play a crucial role in overseeing the overall administration and maintenance of the platform.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;API Provider:&lt;/strong&gt; Tasked with creating and managing API services, this role involves tasks like publishing, updating, and deleting services, along with detailed configuration and management. API Providers are typically backend developers or service owners, emphasizing the availability and performance of services.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Runtime Administrator:&lt;/strong&gt; Responsible for monitoring and managing gateway group operations, ensuring the correct routing of API requests by overseeing runtime status, and performing actions like adding instances, deleting, and rolling back. Runtime administrators are often operations personnel or system administrators, focusing on system stability and reliability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Observer:&lt;/strong&gt; A read-only role that allows viewing information on various platform resources, including service usage and gateway group configurations. However, they lack editing or modification capabilities. Observers, usually business analysts or product managers, leverage this role to understand the platform's operational status for informed decision-making.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B-LGaMac--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/15/YIkHQBsW_RBAC1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B-LGaMac--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/15/YIkHQBsW_RBAC1.png" alt="RBAC_1" width="800" height="196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fBAhbhjM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/15/aW5I1lbP_RBAC2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fBAhbhjM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/15/aW5I1lbP_RBAC2.png" alt="RBAC_2" width="800" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Resource Constraints
&lt;/h3&gt;

&lt;p&gt;In addition to the fundamental role of division and permission controls, API7 introduces the concept of scoped limitations. This means that roles can have additional access constraints, providing a more granular control over permissions.&lt;/p&gt;

&lt;p&gt;For instance, with the API Provider role, restrictions can be applied to limit access and management to specific service scopes. Even if two users share the API Provider role, their access may be restricted to only the services assigned to them individually. Similarly, for the Runtime Administrator role, limitations can be imposed to manage and configure specific gateway group scopes.&lt;/p&gt;

&lt;p&gt;The introduction of scope limitations significantly enhances API7's security. It ensures that users can only interact with resources they are explicitly authorized to access, mitigating the risks of unauthorized actions and data exposure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T3FcSyZ9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/15/0NN84giU_RBAC3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T3FcSyZ9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://static.apiseven.com/uploads/2024/01/15/0NN84giU_RBAC3.png" alt="RBAC_3" width="800" height="824"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;With its refined RBAC functionality, the API7 platform offers enterprises an efficient and flexible permission management solution. It streamlines the permission management process, boosting administrative efficiency while minimizing the risk of errors. Through role assignment, permission management, and scope limitations, API7 effectively governs user access to resources, safeguarding the &lt;a href="https://api7.ai/blog/api7-enterprise-fips"&gt;security&lt;/a&gt; and stability of APIs.&lt;/p&gt;

&lt;p&gt;For enterprises in search of an advanced and dependable API management solution, API7 stands out as a compelling choice. Its robust RBAC features empower enterprises to implement nuanced permission management for APIs, ultimately enhancing overall security and operational efficiency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recommended Reading
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/api-management-2024-trends"&gt;Top 8 API Management Trends in 2024: Foreseeing Our Future Technological Connections&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/chaining-api-requests-with-api-gateway"&gt;Chaining API Requests with API Gateway&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/10-reasons-for-choosing-api7"&gt;Deep Dive into Authentication in Microservices&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Service Discovery: Key to Unleashing Microservices Architecture</title>
      <dc:creator>Jing Yan</dc:creator>
      <pubDate>Tue, 16 Jan 2024 03:04:16 +0000</pubDate>
      <link>https://dev.to/apisix/service-discovery-key-to-unleashing-microservices-architecture-356c</link>
      <guid>https://dev.to/apisix/service-discovery-key-to-unleashing-microservices-architecture-356c</guid>
      <description>&lt;p&gt;As the trend of microservices architecture gains momentum, an increasing number of enterprises are embracing the shift towards this &lt;a href="https://api7.ai/solutions/monolith-to-microservices" rel="noopener noreferrer"&gt;modern solution&lt;/a&gt;. Microservices architecture, a contemporary approach, breaks down conventional large monolithic applications into a set of small, self-contained services. While offering developers remarkable flexibility and scalability, this architectural paradigm also introduces new challenges. Among these challenges, we will delve into a key player today – "Service Discovery in Microservices Architecture."&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Service Discovery?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/what-is-service-discovery-in-microservices" rel="noopener noreferrer"&gt;Service discovery&lt;/a&gt; is the automated process of identifying and recognizing available services within a distributed system. Its primary aim is to facilitate communication and establish connections among services running on different servers in a microservices architecture. Consider, for example, the creation of an online shopping platform where distinct teams independently develop order, payment, and user services. When the order service needs to communicate with the payment service, it queries the service discovery system for the payment service's address. The service discovery system responds with the address, enabling dynamic communication between services. This automated search for services enhances the flexibility, scalability, and ease of maintenance of a microservices system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic Principles of Service Discovery
&lt;/h2&gt;

&lt;p&gt;The primary goal of service discovery is to simplify communication between microservices, enabling automatic connection through a dedicated system. The core principles involve service registration, service querying, and dynamic updates.&lt;/p&gt;

&lt;p&gt;Upon launching a service, it registers essential details, such as its name and address, with the service discovery system. This allows other services to query its available services through the system, streamlining connection establishment. During periods of increased system load, service instances may dynamically scale, and real-time updates to the registration table by the service discovery system ensure system flexibility and stability.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.apiseven.com%2Fuploads%2F2024%2F01%2F15%2FLC6r8Oe1_Service-Discovery-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.apiseven.com%2Fuploads%2F2024%2F01%2F15%2FLC6r8Oe1_Service-Discovery-1.png" alt="Service_Discovery_1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.apiseven.com%2Fuploads%2F2024%2F01%2F15%2FHtL1xTWJ_Service-Discovery-2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fstatic.apiseven.com%2Fuploads%2F2024%2F01%2F15%2FHtL1xTWJ_Service-Discovery-2.png" alt="Service_Discovery_2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages of Service Discovery
&lt;/h2&gt;

&lt;p&gt;As a pivotal technology in microservices architecture, service discovery empowers the construction of distributed systems in several ways.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Dynamic Flexibility: In contrast to traditional monolithic applications with static service locations, microservices architecture allows service instances to dynamically start, stop, or migrate across hosts. This dynamic nature necessitates a service discovery mechanism capable of managing these fluctuations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Automated Service Localization: Service discovery streamlines the process of locating services by automating it. Developers no longer need to manually configure service location information; instead, they rely on a registry to fetch the addresses of service instances. This simplifies configuration, elevates system maintainability, and mitigates a range of production incidents stemming from configuration errors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Resilience and Load Balancing: In situations where a service instance becomes unavailable, the service registry can automatically mark it as unhealthy, preventing the routing of requests to it. Concurrently, load balancing algorithms, attuned to the health status of service instances, distribute requests among viable instances, achieving equitable traffic allocation and ensuring robust system availability.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;In a nutshell, service discovery provides robust support for the construction of distributed systems, offering not only flexibility and elasticity but also streamlining the entire development, deployment, and maintenance processes, a significant advantage in the context of today's fast-paced and ever-changing business environment.&lt;/p&gt;

&lt;p&gt;It's crucial to highlight that, in the realm of microservices architecture, service discovery is just one piece of the puzzle in building a dependable and efficient system. As businesses advance and the number of microservices grows, the intricacies of communication and data interaction between services intensify. At this stage, the introduction of an &lt;a href="https://api7.ai/blog/what-is-an-api-gateway" rel="noopener noreferrer"&gt;API gateway&lt;/a&gt;, becomes paramount. To find out more about API management solutions, you can contact &lt;a href="https://api7.ai/" rel="noopener noreferrer"&gt;API7.ai&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recommended Reading
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/api-management-2024-trends" rel="noopener noreferrer"&gt;Top 8 API Management Trends in 2024: Foreseeing Our Future Technological Connections&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/chaining-api-requests-with-api-gateway" rel="noopener noreferrer"&gt;Chaining API Requests with API Gateway&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://api7.ai/blog/10-reasons-for-choosing-api7" rel="noopener noreferrer"&gt;Deep Dive into Authentication in Microservices&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
