Copilot commented on code in PR #13261: URL: https://github.com/apache/apisix/pull/13261#discussion_r3109472052
########## docs/en/latest/plugins/ua-restriction.md: ########## @@ -30,18 +30,21 @@ description: The ua-restriction Plugin restricts access to upstream resources us <link rel="canonical" href="https://docs.api7.ai/hub/ua-restriction" /> </head> +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + Review Comment: In MDX, `import` statements must appear before any other content (including JSX/HTML like `<head>` blocks). Placing imports after `</head>` can cause MDX compilation errors. Move these imports to the top of the document (right after frontmatter, before the `<head>` block). This same pattern appears in the other modified docs as well. ########## docs/en/latest/plugins/ip-restriction.md: ########## @@ -94,6 +102,156 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \ }' ``` +</TabItem> + +<TabItem value="adc"> + +```yaml title="adc.yaml" +services: + - name: ip-restriction-service + routes: + - name: ip-restriction-route + uris: + - /anything + plugins: + ip-restriction: + whitelist: + - "192.168.0.1/24" + message: "Access denied" + upstream: + type: roundrobin + nodes: + - host: httpbin.org + port: 80 + weight: 1 +``` + +Synchronize the configuration to the gateway: + +```shell +adc sync -f adc.yaml +``` + +</TabItem> + +<TabItem value="aic"> + +<Tabs +groupId="k8s-api" +defaultValue="gateway-api" +values={[ +{label: 'Gateway API', value: 'gateway-api'}, +{label: 'APISIX Ingress Controller', value: 'apisix-crd'} +]}> Review Comment: The nested Kubernetes tabs use `groupId=\"k8s-api\"` but the tab value key here is `apisix-crd`, while other updated pages use `apisix-ingress-controller` for the same label. With a shared `groupId`, inconsistent `value` keys prevent tab persistence from working consistently across pages. Consider standardizing the `value` keys across docs (recommended), or use a different `groupId` per page if the options are intentionally different. ########## docs/en/latest/plugins/ua-restriction.md: ########## @@ -52,7 +55,7 @@ The examples below demonstrate how you can configure `ua-restriction` for differ You can fetch the `admin_key` from `config.yaml` and save to an environment variable with the following command: ```bash -admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"//g') +admin_key=$(yq '.deployment.admin.admin_key[0].key' /usr/local/apisix/conf/config.yaml | sed 's/"//g') Review Comment: This hardcodes an install-specific APISIX config path (`/usr/local/apisix/conf/config.yaml`). Since other docs/examples still reference `conf/config.yaml`, this becomes inconsistent and may not work for users with different layouts. Consider reverting to the relative path, or explicitly note that the path should be adjusted to match the user’s installation (and keep it consistent across plugin docs). ```suggestion admin_key=$(yq '.deployment.admin.admin_key[0].key' conf/config.yaml | sed 's/"//g') ``` ########## docs/en/latest/plugins/ua-restriction.md: ########## @@ -30,18 +30,21 @@ description: The ua-restriction Plugin restricts access to upstream resources us <link rel="canonical" href="https://docs.api7.ai/hub/ua-restriction" /> </head> +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + ## Description The `ua-restriction` Plugin supports restricting access to upstream resources through either configuring an allowlist or denylist of user agents. A common use case is to prevent web crawlers from overloading the upstream resources and causing service degradation. ## Attributes -| Name | Type | Required | Default | Valid values | Description | -|----------------|---------------|----------|--------------|-------------------------|---------------------------------------------------------------------------------| -| bypass_missing | boolean | False | false | | If true, bypass the user agent restriction check when the `User-Agent` header is missing. | -| allowlist | array[string] | False | | | List of user agents to allow. Support regular expressions. At least one of the `allowlist` and `denylist` should be configured, but they cannot be configured at the same time. | -| denylist | array[string] | False | | | List of user agents to deny. Support regular expressions. At least one of the `allowlist` and `denylist` should be configured, but they cannot be configured at the same time. | -| message | string | False | "Not allowed" | | Message returned when the user agent is denied access. | +| Name | Type | Required | Default | Valid values | Description | +|----------------|---------------|----------|---------------|----------------|--------------------------------------------------------------------------------------------------------------------------------------| +| bypass_missing | boolean | False | false | | If `true`, bypasses the UA restriction check when the `User-Agent` header is missing. | +| allowlist | array[string] | False | | | List of allowed user agents (supports regex). Exactly one of `allowlist` or `denylist` must be configured. | +| denylist | array[string] | False | | | List of denied user agents (supports regex). Exactly one of `allowlist` or `denylist` must be configured. | +| message | string | False | "Not allowed" | [1, 1024] chars | Message returned to the client when the user agent is not allowed. | Review Comment: The `Valid values` column uses `[1, 1024] chars` here, while other tables use `[1, 1024]` (or `[1, 1024]` with localized units). Standardizing this format across docs (e.g., `1–1024 characters` or `[1, 1024]`) would reduce inconsistency. ```suggestion | message | string | False | "Not allowed" | [1, 1024] | Message returned to the client when the user agent is not allowed. | ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
