Skip to content

Commit a0bffd9

Browse files
committed
Add HTTP redirect examples
1 parent d9c5b63 commit a0bffd9

File tree

1 file changed

+12
-2
lines changed
  • src/content/docs/cloudflare-one/policies/gateway/http-policies

1 file changed

+12
-2
lines changed

src/content/docs/cloudflare-one/policies/gateway/http-policies/index.mdx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,21 @@ The Redirect action allows you to redirect matched HTTP requests to a different
9797

9898
#### Policy settings
9999

100-
In **Policy URL redirect**, you can define what URL to redirect matched requests to.
100+
In **Policy URL redirect**, you can define what URL to redirect matched requests to. The redirect URL can contain paths and queries. For example, you can redirect `example.com` to `cloudflare.com/path/to/page?querystring=x`.
101101

102102
<Render file="gateway/policy-context" />
103103

104-
When you turn on **Preserve original URL and query string**, Gateway will append the original path and query string to the redirected URL. For example, if the original URL is `example.com/path/to/page?query&string` and the redirect URL is `internalapp.com`, Gateway will redirect requests to `internalapp.com/path/to/page?query&string`.
104+
When you turn on **Preserve original path and query string**, Gateway will append the original path and query string to the redirected URL. Paths and queries in the redirect URL take precedence. For example, if the original URL is `example.com/path/to/page?querystring=X` and the redirect URL is `cloudflare.com/redirect-path?querystring=Y`, Gateway will redirect requests to:
105+
106+
```txt "cloudflare.com/redirect-path" "?querystring=Y"
107+
cloudflare.com/redirect-path/path/to/page?querystring=Y
108+
```
109+
110+
When you turn on both options, Gateway will preserve the original path and query string, then append context policy to the end of the redirect URL. For example, if the original URL is `example.com/path/to/page?querystring=X&k=1` and the redirect URL is `cloudflare.com/redirect-path?querystring=Y`, Gateway will redirect requests to:
111+
112+
```txt "cloudflare.com/redirect-path" "?querystring=Y" ins="&[email protected]"
113+
cloudflare.com/redirect-path/path/to/page?querystring=Y&k=1&[email protected]
114+
```
105115

106116
### Isolate
107117

0 commit comments

Comments
 (0)