Code Monkey home page Code Monkey logo

cloudflare-docs's Introduction

Cloudflare Docs

View the docs →

Contribute to the docs

Setup

You must have Hugo installed on your system and available in your $PATH as a global binary. Most operating systems are supported – follow the relevant installation instructions for your operating system to get started.

Important: This project is built with version 0.123.5+extended and is the minimum required version. You may (probably) use a newer version of Hugo, but will be subject to any Hugo changes.

You must also have a recent version of Node.js (18+) installed. You may use Volta, a Node version manager, to install the latest version of Node and npm, which is a package manager that is included with node's installation.

$ curl https://get.volta.sh | bash
$ volta install node

Finally, install the Node.js dependencies for this project using npm or another package manager:

$ npm install

Development

When making changes to the site, including any content changes, you may run a local development server by running the following command:

$ npm run dev

This spawns a server that will be accessible via http://localhost:5173 in your browser. Additionally, any changes made within the project – including content/** changes – will automatically reload your browser tab(s), allowing you to instantly preview your changes.

Additionally, this project includes a CI step for ensuring consistent code style. This applies to all files within the project, including markdown (*.md) files, but will not affect the content itself or the content's output display. To see the style error(s), you may run:

$ npm run lint

Recommendations

Part of our application accesses the GitHub API (to populate the Wrangler changelog).

Since GitHub gives a higher request limit to authenticated requests, you may want to add a classic token with permissions for repos:public_repo to /assets/secrets/github_token.txt. The token value should be the only thing in your file.

Deployment

Our docs are deployed using Cloudflare Pages. Every commit pushed to production will automatically deploy to developers.cloudflare.com, and any pull requests opened will have a corresponding staging URL available in the pull request comments.

Available Visual Studio Code snippets

Refer to Visual Studio Code snippets for more information.

For Cloudflare employees

To get write access to this repo, please reach out to the Developer Docs room in chat.

License and Legal Notices

Except as otherwise noted, Cloudflare and any contributors grant you a license to the Cloudflare Developer Documentation and other content in this repository under the Creative Commons Attribution 4.0 International Public License, see the LICENSE file, and grant you a license to any code in the repository under the MIT License, see the LICENSE-CODE file.

Cloudflare products and services referenced in the documentation may be either trademarks or registered trademarks of Cloudflare in the United States and/or other countries. The licenses for this project do not grant you rights to use any Cloudflare names, logos, or trademarks. Cloudflare's general trademark guidelines can be found at https://www.cloudflare.com/trademark/. Cloudflare and any contributors reserve all other rights, whether under their respective copyrights, patents, or trademarks, whether by implication, estoppel, or otherwise.

cloudflare-docs's People

Contributors

abracchi-tw avatar adamschwartz avatar angelampcosta avatar cicku avatar crwaters16 avatar dcpena avatar deadlypants1973 avatar elithrar avatar erisa avatar irvinebroque avatar jason-cf avatar jdesgats avatar kiannh avatar kkrum avatar kodster28 avatar kristianfreeman avatar lukeed avatar maddy-cloudflare avatar marciocloudflare avatar maxvp avatar ngayerie avatar patriciasantaana avatar pedrosousa avatar ranbel avatar rebeccatamachiro avatar rozenmd avatar townlake avatar unknownhad avatar vs-mg avatar walshydev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudflare-docs's Issues

Typo on Set up Cloudflare Access page

products/access/src/content/getting-started/access-setup.md says:

"Choose an authentication domain. The authentication domain will represent you Cloudflare for Teams and the URL will serve as the launch page for end users."

Should that be "represent you to Cloudflare for Teams"? Or perhaps "represent you on Cloudflare for Teams"?

Add `robots.txt` to test sites

As stated in the README, we deploy projects to both a testing site (cloudflare-docs.workers.dev) and a production site (workers.cloudflare.com):

Test sites deploy to:
```txt
https://[pathPrefix].cloudflare-docs.workers.dev/[pathPrefix]/
```
Production sites deploy to:
```txt
https://developers.cloudflare.com/[pathPrefix]/
```

We should instruct search engines to ignore the test sites via a robots.txt with:

User-agent: * Disallow: /

How to append an element to element

So the below handler allows us to do things with element. I am wondering how can we append a nested/child element to element?

class ElementHandler {
  element(element) {
    // An incoming element, such as `div`
    console.log(`Incoming element: ${element.tagName}`)
  }
}

Content-Type header missing from QR Code Worker Example

"The QR code example located here: https://developers.cloudflare.com/workers/tutorials/build-a-serverless-function seems to be missing the correct Content-Type header.

Here's what the example code looks like:

const generate = async request => {
// ...
return new Response(qr_png, { headers })
}
The paragraph right above it mentions the header that should be there, but the code doesn't match.

By default, the QR code is generated as a PNG. Construct a new instance of Response, passing in the PNG data as the body, and a Content-Type header of image/png: this will allow browsers to properly parse the data coming back from your serverless function, as an image:"

cloudflare/workers-docs#965

Expand "How KV Works"

Need to migrate over more content about namespaces, usecases, etc. in a new guide.
I would prioritize this.

Update package.json scripts to support Windows users

It has been reported that this fixes the issue:

{
  "private": true,
  "dependencies": {
    "cloudflare-docs-engine": "git+https://github.com/cloudflare/cloudflare-docs-engine.git"
  },
  "scripts": {
    "bootstrap": "sh ./node_modules/cloudflare-docs-engine/bin/commands.sh bootstrap",
    "build": "sh ./node_modules/cloudflare-docs-engine/bin/commands.sh build",
    "develop": "sh ./node_modules/cloudflare-docs-engine/bin/commands.sh develop",
    "ghactionsbootstrap": "sh ./node_modules/cloudflare-docs-engine/bin/commands.sh ghactionsbootstrap",
    "savechanges": "sh ./node_modules/cloudflare-docs-engine/bin/commands.sh savechanges",
    "serve": "sh ./node_modules/cloudflare-docs-engine/bin/commands.sh serve"
  }
}

Updates to Getting started guide

  • Step 5 of the getting started guide currently recommends wrangler preview but we should be pushing people towards wrangler dev

  • Step 6 should recommend using wrangler login for expediency :)

Outdated Argo tunnel arguments / config file elements documentation

The documentation for the argo tunnel command line arguments is very outdated. Please update documentation.

Here's the relevant output from cloudflared.exe tunnel --help:

OPTIONS:
   --config value                                      Specifies a config file in YAML format.
   --origincert value                                  Path to the certificate generated for your origin when you run cloudflared login. (default: "C:\\Users\\vakadm.STOLTUAT\\.cloudflared\\cert.pem") [%TUNNEL_ORIGIN_CERT%]
   --autoupdate-freq value                             Autoupdate frequency. Default is 24h0m0s. (default: 24h0m0s)
   --no-autoupdate                                     Disable periodic check for updates, restarting the server with the new version. (default: false) [%NO_AUTOUPDATE%]
   --metrics value                                     Listen address for metrics reporting. (default: "localhost:") [%TUNNEL_METRICS%]
   --pidfile value                                     Write the application's PID to this file after first successful connection. [%TUNNEL_PIDFILE%]
   --url URL                                           Connect to the local webserver at URL. (default: "http://localhost:8080") [%TUNNEL_URL%]
   --hello-world                                       Run Hello World Server (default: false) [%TUNNEL_HELLO_WORLD%]
   --socks5                                            specify if this tunnel is running as a SOCK5 Server (default: false) [%TUNNEL_SOCKS%]
   --proxy-connect-timeout value                       HTTP proxy timeout for establishing a new connection (default: 30s)
   --proxy-tls-timeout value                           HTTP proxy timeout for completing a TLS handshake (default: 10s)
   --proxy-tcp-keepalive value                         HTTP proxy TCP keepalive duration (default: 30s)
   --proxy-no-happy-eyeballs                           HTTP proxy should disable "happy eyeballs" for IPv4/v6 fallback (default: false)
   --proxy-keepalive-connections value                 HTTP proxy maximum keepalive connection pool size (default: 100)
   --proxy-keepalive-timeout value                     HTTP proxy timeout for closing an idle connection (default: 1m30s)
   --proxy-connection-timeout value                    HTTP proxy timeout for closing an idle connection (default: 1m30s)
   --proxy-expect-continue-timeout value               HTTP proxy timeout for closing an idle connection (default: 1m30s)
   --http-host-header value                            Sets the HTTP Host header for the local webserver. [%TUNNEL_HTTP_HOST_HEADER%]
   --origin-server-name value                          Hostname on the origin server certificate. [%TUNNEL_ORIGIN_SERVER_NAME%]
   --unix-socket value                                 Path to unix socket to use instead of --url [%TUNNEL_UNIX_SOCKET%]
   --origin-ca-pool value                              Path to the CA for the certificate of your origin. This option should be used only if your certificate is not signed by Cloudflare. [%TUNNEL_ORIGIN_CA_POOL%]
   --no-tls-verify                                     Disables TLS verification of the certificate presented by your origin. Will allow any certificate from the origin to be accepted. Note: The connection from your machine to Cloudflare's Edge is still encrypted. (default: false) [%NO_TLS_VERIFY%]
   --no-chunked-encoding                               Disables chunked transfer encoding; useful if you are running a WSGI server. (default: false) [%TUNNEL_NO_CHUNKED_ENCODING%]
   --bastion                                           Runs as jump host (default: false) [%TUNNEL_BASTION%]
   --proxy-address value                               Listen address for the proxy. (default: "127.0.0.1") [%TUNNEL_PROXY_ADDRESS%]
   --proxy-port value                                  Listen port for the proxy. (default: 0) [%TUNNEL_PROXY_PORT%]
   --loglevel value                                    Application logging level {fatal, error, info, debug}. At debug level, request URL, method, protocol, content legnth and header will be logged. Response status, content length and header will also be logged in debug level. (default: "info") [%TUNNEL_LOGLEVEL%]
   --transport-loglevel value, --proto-loglevel value  Transport logging level(previously called protocol logging level) {fatal, error, info, debug} (default: "fatal") [%TUNNEL_PROTO_LOGLEVEL%, %TUNNEL_TRANSPORT_LOGLEVEL%]
   --logfile value                                     Save application log to this file for reporting issues. [%TUNNEL_LOGFILE%]
   --log-directory value                               Save application log to this directory for reporting issues. [%TUNNEL_LOGDIRECTORY%]
   --trace-output value                                Name of trace output file, generated when cloudflared stops. [%TUNNEL_TRACE_OUTPUT%]
   --proxy-dns                                         Run a DNS over HTTPS proxy server. (default: false) [%TUNNEL_DNS%]
   --proxy-dns-port value                              Listen on given port for the DNS over HTTPS proxy server. (default: 53) [%TUNNEL_DNS_PORT%]
   --proxy-dns-address value                           Listen address for the DNS over HTTPS proxy server. (default: "localhost") [%TUNNEL_DNS_ADDRESS%]
   --proxy-dns-upstream value                          Upstream endpoint URL, you can specify multiple endpoints for redundancy. (default: "https://1.1.1.1/dns-query", "https://1.0.0.1/dns-query") [%TUNNEL_DNS_UPSTREAM%]
   --proxy-dns-bootstrap value                         bootstrap endpoint URL, you can specify multiple endpoints for redundancy. (default: "https://162.159.36.1/dns-query", "https://162.159.46.1/dns-query", "https://[2606:4700:4700::1111]/dns-query", "https://[2606:4700:4700::1001]/dns-query") [%TUNNEL_DNS_BOOTSTRAP%]
   --hostname value                                    Set a hostname on a Cloudflare zone to route traffic through this tunnel. [%TUNNEL_HOSTNAME%]
   --lb-pool value                                     The name of a (new/existing) load balancing pool to add this origin to. [%TUNNEL_LB_POOL%]
   --metrics-update-freq value                         Frequency to update tunnel metrics (default: 5s) [%TUNNEL_METRICS_UPDATE_FREQ%]
   --tag KEY=VALUE                                     Custom tags used to identify this tunnel, in format KEY=VALUE. Multiple tags may be specified [%TUNNEL_TAG%]
   --retries value                                     Maximum number of retries for connection/protocol errors. (default: 5) [%TUNNEL_RETRIES%]
   --compression-quality value                         (beta) Use cross-stream compression instead HTTP compression. 0-off, 1-low, 2-medium, >=3-high. (default: 0) [%TUNNEL_COMPRESSION_LEVEL%]
   --name value, -n value                              Stable name to identify the tunnel. Using this flag will create, route and run a tunnel. For production usage, execute each command separately [%TUNNEL_NAME%]
   --ui                                                Launch tunnel UI. Tunnel logs are scrollable via 'j', 'k', or arrow keys. (default: false)
   --help, -h                                          show help (default: false)
   --version, -v, -V                                   Print the version (default: false)

Documentation Prefixes (BYOIP)

Hey,
I notices multiple Prefixes on the BYOIP Docs to be none Cloudflare ones.

Maybe update them to Documentation Prefixes or Cloudflare owned.

For example

  • 162.211.156.0/24
  • 1.2.3.4/24

Redirect old "updating the CLI" link to new destination

wrangler contains a link to instructions to update the CLI, if we notice there's a new version. The link goes to
https://workers.cloudflare.com/docs/quickstart/updating-the-cli/

However, that now 404s. Can we make that redirect to https://developers.cloudflare.com/workers/cli-wrangler/install-update ?

See cloudflare/wrangler-legacy#1552 where this was fixed in wrangler – but users with old versions of wrangler will still be getting shown a broken link when prompted to upgrade.

RFC: multi language code samples / runtime APIs

We should be able to show off the polyglot nature of Workers by having code samples in different languages. An MVP might be JavaScript and TypeScript, but we should consider how Rust would work. I wanted to create this issue to get some thoughts on the best way we could do this.

Should there be a language toggle per code sample? for the entire documentation page?

`wrangler dev` documentation should be clear that the Worker is being run remotely

The documentation for wrangler dev implies that the "server on `localhost" is "execut[ing] your Worker": https://developers.cloudflare.com/workers/cli-wrangler/commands#dev

We should update this to be clear that the Worker code is uploaded to Cloudflare's API and the Worker is being invoked at the edge, as described in more detail here: https://blog.cloudflare.com/announcing-wrangler-dev-the-edge-on-localhost/ .

This causes confusion for users who expect that wrangler dev's local server can make requests to locally-running services that are not exposed to the Internet, among other issues.

Document behavior and limits of calling `fetch()` to another Worker

"I couldn't find this in the docs currently.

We should document the behavior and limitations of making a fetch() call to a URL that matches a route that runs a Worker.

If the fetch URL is on the same zone as the original request, the request will go to the origin, and will not be handled by any other Worker.
If the fetch URL is on a different zone, the request will be handled by the Worker matching the route." cloudflare/workers-docs#858

Redirects needed for byoip docs

OLD,NEW
/byoip/api/*,/byoip/dynamic-advertisement/*
/byoip/dynamic-advertisement/configure-prefixes,/byoip/dynamic-advertisement/configure-dynamic-advertisement
/byoip/irr/*,/byoip/irr-records/*
/byoip/about,/byoip/getting started
byoip/delegations,/byoip/prefix-delegations

*Edit I forgot to add the wildcard after routes that have pages underneath them

Incremental builds

The prior stand-alone Workers docs repo used to have incremental builds:

https://github.com/cloudflare/cloudflare-docs-engine/blob/19b0a89bd4b6cb37b8f965ed0213170c97945bad/.github/workflows/build.yml#L10-L21

https://github.com/cloudflare/cloudflare-docs-engine/blob/19b0a89bd4b6cb37b8f965ed0213170c97945bad/.github/workflows/deploy.yml#L15-L24

(The links are @cloudflare/cloudflare-docs-engine but this used to be the @cloudflare/workers-docs-engine repo.)

Should we re-implement that in this new Cloudflare docs repo?

deploy-workers:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: products/workers
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 14.2.0
- run: |
npm install
mkdir .docs
npm run bootstrap
npm run build
- name: Publish staging
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
workingDirectory: "products/workers"
- name: Publish production
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
workingDirectory: "products/workers"
environment: "production"

Is it possible that this somehow come from https://github.com/cloudflare/cloudflare-docs-engine? I can’t think of a great way to handle this. Best I can think of is for the engine or its documentation to provide build.yml and deploy.yml templates...

The terraform docs and examples are based on an old version of the cloudflare provider

The tutorial shows examples from and is based on an old version of the cloudflare terraform provider.

For example, the Hello World example uses the token parameter while that's been renamed to api_key.

A much more minor nitpick: there are several typos throughout the guide (eg: "As you configuration" on the Hello World guide).

Thanks for creating the Terraform provider and the cf-terraforming importer, they're very useful! It was just a bit harder to get started than it should have been since the docs were out of date.

Redirects for Registrar docs

OLD,NEW
/registrar/about,/registrar
/registrar/domain-transfers/domain-billing-exp,/registrar/domain-transfers/transfer-costs
/registrar/domain-registration/tld-support,/registrar/domain-registration/tlds-supported
/registrar/cloudflare-registrar/dnssec,/registrar/cloudflare-registrar/enabling-dnssec
/registrar/cloudflare-registrar/leaving-cloudflare,/registrar/cloudflare-registrar/transfer-out-from-cloudflare
/registrar/domain-registration/sec-reg-diff,/registrar/domain-registration/cloudflare-custom-domain-protection
/registrar/domain-transfers/transfer-flow,/registrar/domain-transfers/transfer-to-cloudflare
/registrar/domain-transfers/troubleshoot-transfer,/registrar/domain-transfers/troubleshoot-a-stalled-transfer

Update Request documentation to indicate which properties are restricted by plan level

Some of the properties in RequestInitCfProperties only work if the account owner has a certain minimum plan level, and some of the properties in IncomingRequestCfProperties are only present if the account owner has a certain minimum plan level.

We previously documented this, but in the content migration to the new docs engine, we dropped it. We should label properties on that page as appropriate.

Document the Headers class

The Headers class is pretty straightforward, but its behavior is the source of some frequently asked questions. We should document its behavior in at least these regards:

  • The comma-concatenation behavior of Headers.get(). If a Headers object is constructed from a message with multiple instances of the same header, Headers.get() will return a single string (not an array) with each of the multiple header values concatenated together with intervening ", ".
  • The comma-concatenation described above is a valid transformation for any well-behaved header, with one infamous exception: Set-Cookie. For this reason, we implement the old, removed Headers.getAll() function, but only for the Set-Cookie header (it throws if you try to access anything else). You can read the saga behind this here: whatwg/fetch#973
  • The Cloudflare Workers implementation of Headers.get() returns a USVString (or null, of course), not a ByteString as required by the spec. In English, this means we interpret the header bytes on the wire as UTF-8, decode them, and expose them as Unicode strings in JavaScript. We once tried to "fix" this by switching to ByteStrings, but ByteStrings are difficult to use correctly, and in practice it is common to set a header from the contents of URLSearchParams.get(), which returns a USVString, and would thus produce a corrupt header.
  • Related to the above, we warn in the preview if a script does try to add a ByteString to a Headers object. Example: https://cloudflareworkers.com/#2b9b84913d7147de5592b6306404e128:https://tutorial.cloudflareworkers.com

/cc @ispivey

Wrangler Installation

In "2. Install the Workers CLI", due to this issue, provide link to alternative installation via yarn or by building locally.

Webpack usage and npm dependencies could use more explanation

"The docs are not very clear on how to use npm dependencies.

The answer (I believe?) is to use webpack. There is a page on webpack:

https://developers.cloudflare.com/workers/tooling/wrangler/webpack/

But this page is also not very clear -- it seems to assume the reader is already deeply familiar with webpack, and only provides some advanced details.

We should improve the doc so that people new to webpack don't need to go learn webpack first, and highlight better than this is the way to use npm dependencies."

"Incoming request cf properties" should include information about minimum required plan levels

Reported on Community here, https://community.cloudflare.com/t/incoming-request-cf-properties/199908

I am finding out the correct plan for incoming request cf. I came from this article.

developers.cloudflare.com

Request · Cloudflare Workers docs
Documentation for Cloudflare Workers, a serverless execution environment that allows you to create entirely new applications or augment existing ones without configuring or maintaining infrastructure.

As for the free plan -
I can get

request.cf.asn;
request.cf.colo;

but not city,latitude,longitude,continent,postalCode,metroCode,region,regionCode,timezone,region .
May I know pro plan of cloudflare can give which of these . Thank you.

These fields were typically only available on Business plans and higher

https://web.archive.org/web/20200414104608/https://developers.cloudflare.com/workers/reference/apis/request/

The current documentation does not mention that any more, however the limitation was not changed, rather the documentation needs updating.

So, Business plans and higher.

Incorrect WebCrypto's getRandomValues signature

Both MDN and the spec state that the crypto.getRandomValues() function should return the passed ArrayBuffer with random values inside it, but the Cloudflare Workers docs says it returns a Promise<ArrayBuffer> instead.

I do hope this is just a typo.

Redirects needed for Image Resizing docs

OLD                          NEW
/images/about                /images
/images/responsive           /images/responsive-images
/images/worker               /images/resizing-with-workers
/images/overlays             /images/drawing-overlays
/images/errors               /images/troubleshooting
/images/protected-origin/    /images/controlling-origin-access

See 1f6f131

cc @dotjs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.