Copilot commented on code in PR #13260: URL: https://github.com/apache/apisix/pull/13260#discussion_r3109473544
########## docs/en/latest/plugins/ua-restriction.md: ########## @@ -88,6 +102,162 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \ }' ``` +</TabItem> + +<TabItem value="adc"> + +```yaml title="adc.yaml" +services: + - name: ua-restriction-service + routes: + - name: ua-restriction-route + uris: + - /anything + plugins: + ua-restriction: + bypass_missing: false + denylist: + - "(Baiduspider)/(\\d+)\\.(\\d+)" + - "bad-bot-1" + 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-ingress-controller'} +]}> + +<TabItem value="gateway-api"> + +```yaml title="ua-restriction-ic.yaml" +apiVersion: v1 +kind: Service +metadata: + namespace: aic + name: httpbin-external-domain +spec: + type: ExternalName Review Comment: The Gateway API example defines an `ExternalName` Service without any `ports`. However, the `HTTPRoute.backendRefs` later specifies `port: 80`, which typically must match a declared Service port. Add a `ports` section (e.g., port 80) to the Service so the example is runnable as written. ```suggestion type: ExternalName ports: - port: 80 ``` ########## docs/en/latest/plugins/ua-restriction.md: ########## @@ -88,6 +102,162 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \ }' ``` +</TabItem> + +<TabItem value="adc"> + +```yaml title="adc.yaml" +services: + - name: ua-restriction-service + routes: + - name: ua-restriction-route + uris: + - /anything + plugins: + ua-restriction: + bypass_missing: false + denylist: + - "(Baiduspider)/(\\d+)\\.(\\d+)" + - "bad-bot-1" + 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-ingress-controller'} +]}> Review Comment: This page defines the nested Ingress Controller tabs twice using the same `groupId=\"k8s-api\"` (also later in the second example). In Docusaurus, identical `groupId`s synchronize tab state across all instances on the page, which can unintentionally switch the other example when toggling tabs. If cross-example sync is not intended, use distinct groupIds per example (or omit `groupId`). ########## docs/zh/latest/plugins/ua-restriction.md: ########## @@ -88,6 +102,162 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \ }' ``` +</TabItem> + +<TabItem value="adc"> + +```yaml title="adc.yaml" +services: + - name: ua-restriction-service + routes: + - name: ua-restriction-route + uris: + - /anything + plugins: + ua-restriction: + bypass_missing: false + denylist: + - "(Baiduspider)/(\\d+)\\.(\\d+)" + - "bad-bot-1" + message: "Access denied" + upstream: + type: roundrobin + nodes: + - host: httpbin.org + port: 80 + weight: 1 +``` + +将配置同步到网关: + +```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-ingress-controller'} +]}> + +<TabItem value="gateway-api"> + +```yaml title="ua-restriction-ic.yaml" +apiVersion: v1 +kind: Service +metadata: + namespace: aic + name: httpbin-external-domain +spec: + type: ExternalName + externalName: httpbin.org Review Comment: Gateway API 示例里的 `ExternalName` Service 没有声明 `ports`,但后面的 `HTTPRoute.backendRefs` 使用了 `port: 80`,通常需要与 Service 中已声明的端口匹配。建议在 Service 中补充 `ports`(例如 80),确保示例可直接应用运行。 ```suggestion externalName: httpbin.org ports: - port: 80 targetPort: 80 ``` ########## docs/zh/latest/plugins/ua-restriction.md: ########## @@ -88,6 +102,162 @@ curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \ }' ``` +</TabItem> + +<TabItem value="adc"> + +```yaml title="adc.yaml" +services: + - name: ua-restriction-service + routes: + - name: ua-restriction-route + uris: + - /anything + plugins: + ua-restriction: + bypass_missing: false + denylist: + - "(Baiduspider)/(\\d+)\\.(\\d+)" + - "bad-bot-1" + message: "Access denied" + upstream: + type: roundrobin + nodes: + - host: httpbin.org + port: 80 + weight: 1 +``` + +将配置同步到网关: + +```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-ingress-controller'} +]}> Review Comment: 页面里两处嵌套的 Ingress Controller Tabs 都使用了同一个 `groupId=\"k8s-api\"`(第二个示例处也相同)。在 Docusaurus 中,相同 `groupId` 会导致多个 Tabs 之间联动切换,可能影响读者在不同示例间对比。若不希望联动,建议为每个示例使用不同的 groupId(或移除 `groupId`)。 -- 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]
