From 7e4437eeb0e0fdbb199b9c373cdecfce1dfd8117 Mon Sep 17 00:00:00 2001 From: Arko Dasgupta Date: Tue, 11 Jun 2024 13:55:44 -0700 Subject: [PATCH] docs: update redirect tasks * dont use `port: 443` in the redirect example * dont specify a backendRefs when the filter is a redirect filter Fixes: https://github.com/envoyproxy/gateway/issues/3589 Signed-off-by: Arko Dasgupta --- .../en/latest/tasks/traffic/http-redirect.md | 8 - .../en/v1.0.2/tasks/traffic/http-redirect.md | 163 ++++++++++++++++-- 2 files changed, 153 insertions(+), 18 deletions(-) diff --git a/site/content/en/latest/tasks/traffic/http-redirect.md b/site/content/en/latest/tasks/traffic/http-redirect.md index 2a41777f80b..b3177e89263 100644 --- a/site/content/en/latest/tasks/traffic/http-redirect.md +++ b/site/content/en/latest/tasks/traffic/http-redirect.md @@ -40,7 +40,6 @@ spec: scheme: https statusCode: 301 hostname: www.example.com - port: 443 EOF ``` @@ -66,7 +65,6 @@ spec: scheme: https statusCode: 301 hostname: www.example.com - port: 443 ``` {{% /tab %}} @@ -342,9 +340,6 @@ spec: type: ReplaceFullPath replaceFullPath: /status/200 statusCode: 302 - backendRefs: - - name: backend - port: 3000 EOF ``` @@ -375,9 +370,6 @@ spec: type: ReplaceFullPath replaceFullPath: /status/200 statusCode: 302 - backendRefs: - - name: backend - port: 3000 ``` {{% /tab %}} diff --git a/site/content/en/v1.0.2/tasks/traffic/http-redirect.md b/site/content/en/v1.0.2/tasks/traffic/http-redirect.md index aeb4db8a5a2..b3177e89263 100644 --- a/site/content/en/v1.0.2/tasks/traffic/http-redirect.md +++ b/site/content/en/v1.0.2/tasks/traffic/http-redirect.md @@ -19,6 +19,9 @@ Redirects return HTTP 3XX responses to a client, instructing it to retrieve a di For example, to issue a permanent redirect (301) from HTTP to HTTPS, configure `requestRedirect.statusCode=301` and `requestRedirect.scheme="https"`: +{{< tabpane text=true >}} +{{% tab header="Apply from stdin" %}} + ```shell cat <}} + __Note:__ `301` (default) and `302` are the only supported statusCodes. The HTTPRoute status should indicate that it has been accepted and is bound to the example Gateway. @@ -69,7 +95,7 @@ $ curl -L -vvv --header "Host: redirect.example" "http://${GATEWAY_HOST}/get" ... ``` -If you followed the steps in the [Secure Gateways](../security/secure-gateways) guide, you should be able to curl the redirect +If you followed the steps in the [Secure Gateways](../security/secure-gateways) task, you should be able to curl the redirect location. ## HTTP --> HTTPS @@ -107,8 +133,11 @@ kubectl create secret tls example-com --key=tls.key --cert=tls.crt Define a https listener on the existing gateway +{{< tabpane text=true >}} +{{% tab header="Apply from stdin" %}} + ```shell -cat <}} + Check for any TLS certificate issues on the gateway. ```bash @@ -140,9 +200,11 @@ kubectl -n default describe gateway eg Create two HTTPRoutes and attach them to the HTTP and HTTPS listeners using the [sectionName][] field. +{{< tabpane text=true >}} +{{% tab header="Apply from stdin" %}} ```shell -cat <}} + Curl the example app through http listener: ```bash @@ -203,6 +314,9 @@ curl -v -H 'Host:www.example.com' --resolve "www.example.com:443:$GATEWAY_HOST" Path redirects use an HTTP Path Modifier to replace either entire paths or path prefixes. For example, the HTTPRoute below will issue a 302 redirect to all `path.redirect.example` requests whose path begins with `/get` to `/status/200`. +{{< tabpane text=true >}} +{{% tab header="Apply from stdin" %}} + ```shell cat <}} + The HTTPRoute status should indicate that it has been accepted and is bound to the example Gateway. ```shell