Skip to content

[Workers] Request headers documentation#1817

Merged
deadlypants1973 merged 8 commits into
productionfrom
kate/issue61
Jul 20, 2021
Merged

[Workers] Request headers documentation#1817
deadlypants1973 merged 8 commits into
productionfrom
kate/issue61

Conversation

@deadlypants1973

@deadlypants1973 deadlypants1973 commented Jul 19, 2021

Copy link
Copy Markdown
Contributor

closes #61

Screenshot 2021-07-19 at 21 00 58 (2)

@deadlypants1973 deadlypants1973 added the product:workers Related to Workers product label Jul 19, 2021
@deadlypants1973 deadlypants1973 added this to the Pages and Workers milestone Jul 19, 2021
@deadlypants1973 deadlypants1973 self-assigned this Jul 19, 2021
@deadlypants1973
deadlypants1973 requested a review from a team July 19, 2021 19:50
@deadlypants1973
deadlypants1973 requested a review from a team as a code owner July 19, 2021 19:50
Comment thread products/workers/src/content/runtime-apis/headers.md
Comment thread products/workers/src/content/runtime-apis/headers.md Outdated
Co-authored-by: Luke Edwards <luke.edwards05@gmail.com>
Comment thread products/workers/src/content/runtime-apis/headers.md Outdated
Comment thread products/workers/src/content/runtime-apis/headers.md Outdated
Comment thread products/workers/src/content/runtime-apis/headers.md
Comment thread products/workers/src/content/runtime-apis/headers.md Outdated

### Request headers

* `CF-Connecting-IP`: In same zone Worker subrequests, the value of `CF-Connecting-IP` reflects the value of `x-real-ip` (the client’s IP). `x-real-ip` can be altered by the user in their Worker script.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we hyphenate same-zone?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abracchi-tw good point, I say yes.


* `CF-Connecting-IP`: In same zone Worker subrequests, the value of `CF-Connecting-IP` reflects the value of `x-real-ip` (the client’s IP). `x-real-ip` can be altered by the user in their Worker script.

In cross-zone subrequests from one Cloudflare customer zone to another Cloudflare customer zone, the `CF-Connecting-IP` value will be set to the Worker client IP address `'2a06:98c0:3600::103'` for security reasons.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consolidate whether we use a genitive structure (client's IP) or a noun-noun compound (client IP). Also, do we want to specify address?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abracchi-tw I worked on this with an FL engineer as well as the dev advocates so that's where the 'client IP' came out of. The address went through a security review and they greenlit it so decided to put it in for maximum ~ knowledge ~


When no Worker subrequest is triggered, `cf-connecting-ip` reflects the client's IP address and the `x-real-ip` header is stripped.

* `CF-Worker`: Added to all Worker subrequests sent via `fetch()`. Set to the name of the zone which owns the Worker making the subrequest. For example, a Worker script on route for `foo.example.com/*` from `example.com` will have all subrequests with the header:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want what's after : to be a full sentence? As is the case for the first point of the list

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abracchi-tw I thought the same thing but with the first bullet point, it is unavailable because I have to specify 3 different subrequest use cases for the header. For this header, and the last header, I don't use full sentences.

Comment thread products/workers/src/content/runtime-apis/headers.md Outdated

@kristianfreeman kristianfreeman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super cool to have this documented!

@deadlypants1973
deadlypants1973 merged commit 4a3f83b into production Jul 20, 2021
@deadlypants1973
deadlypants1973 deleted the kate/issue61 branch July 20, 2021 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:workers Related to Workers product

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document headers sent to the origin under the Fetch Runtime API docs

4 participants