Skip to content

Commit cdcc004

Browse files
committed
Add documentation for allow_custom_ports
1 parent 3043827 commit cdcc004

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

src/content/changelogs/workers.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ productLink: "/workers/"
55
productArea: Developer platform
66
productAreaLink: /workers/platform/changelog/platform/
77
entries:
8+
- publish_date: '2024-08-19'
9+
description: |-
10+
- Workers now support the [`allow_custom_ports` compatibility flag](/workers/configuration/compatibility-dates/#allow-specifying-a-custom-port-when-making-a-subrequest-with-the-fetch-api) which enables using the `fetch()` calls to custom ports.
811
- publish_date: '2024-07-19'
912
description: |-
1013
- Workers with the [mTLS](/workers/runtime-apis/bindings/mtls/) binding now support [Gradual Deployments](/workers/configuration/versions-and-deployments/gradual-deployments/).
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
_build:
3+
publishResources: false
4+
render: never
5+
list: never
6+
7+
name: "Allow specifying a custom port when making a subrequest with the fetch() API"
8+
sort_date: "2024-09-02"
9+
enable_date: "2024-09-02"
10+
enable_flag: "allow_custom_ports"
11+
disable_flag: "ignore_custom_ports"
12+
---
13+
14+
When this flag is enabled, and you specify a port when making a subrequest with the [`fetch()` API](/workers/runtime-apis/fetch/), the port number you specify will be used.
15+
16+
When you make a subrequest to a website that uses Cloudflare ("Orange Clouded") — only [ports supported by Cloudflare's reverse proxy](/fundamentals/reference/network-ports/#network-ports-compatible-with-cloudflares-proxy) can be specified. If you attempt to specify an unsupported port, it will be ignored.
17+
18+
When you make a subrequest to a website that doesn't use Cloudflare ("Grey Clouded") - any port can be specified.
19+
20+
For example:
21+
22+
```js
23+
const response = await fetch("https://example.com:8000");
24+
```
25+
With allow_custom_ports the above example would fetch `https://example.com:8000` rather than
26+
`https://example.com:443`.
27+

0 commit comments

Comments
 (0)