Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 56 additions & 15 deletions docs/develop/gateway.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
---
title: Run a Gateway
id: gateway-proxy
id: run-a-gateway
---

This guide explains how to use the [swarm-gateway](https://github.com/ethersphere/swarm-gateway) tool to set up your node in gateway mode. Running your node in gateway mode exposes it publicly, allowing access through any typical browser or http API.
This guide explains how to use the [swarm-gateway](https://github.com/ethersphere/swarm-gateway) tool to set up your node in gateway mode. Running your node in gateway mode exposes it publicly, allowing access through any typical browser or http API.

It is divided into several parts:

* Part 1 - Basic setup
* Part 2 - Securing your gateway with TLS
* Part 3 - Optional features

## Part 1 — Running a Swarm Gateway (HTTP, minimal setup)
## Part 1 - Basic setup

:::info
Historically, the main tool for running a Swarm HTTP gateway was [gateway-proxy](https://github.com/ethersphere/gateway-proxy), however it is planned to be deprecated in favor of [swarm-gateway](https://github.com/ethersphere/swarm-gateway).
Expand Down Expand Up @@ -145,13 +139,41 @@ swarm-cli upload test.txt

This will print a Swarm reference.

Open the file through the gateway:
Open the file through the gateway in your browser:

```text
```bash
http://your-domain.example/bzz/<REFERENCE>/
```

The file contents should be returned.
Or from the terminal:

```bash
url -i http://your-domain.example/bzz/<REFERENCE>/
```

The file contents should be returned.

Example terminal output:

```bash
600/
HTTP/1.1 200 OK
X-Powered-By: Express
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization, swarm-postage-batch-id, swarm-deferred-upload
accept-ranges: bytes
access-control-expose-headers: Content-Disposition
content-disposition: inline; filename="test.txt"
content-type: text/plain; charset=utf-8
date: Mon, 02 Feb 2026 10:21:39 GMT
Content-Length: 12
ETag: W/"c-5RZWYiFSSX7yHMJRTWWjxA9B9oo"
Connection: keep-alive
Keep-Alive: timeout=5

hello swarm
```

### 7. Optional: restrict uploads using authentication

Expand All @@ -169,11 +191,13 @@ Example (add these lines to the `docker run` command):
-e SOFT_AUTH="true" \
```

See the [Swarm Gateway README](https://github.com/ethersphere/swarm-gateway) for more information about authentication and other options.

At this point, you have:

* A working Swarm HTTP gateway
* Connected to your Bee node
* Exposing content publicly over `/bzz/<reference>`
* Content accessible publicly over `/bzz/<reference>`

The setup is intentionally minimal and suitable for testing and development, however without TLS, it is not secure and should never be used in production or publicly exposed.

Expand Down Expand Up @@ -245,12 +269,12 @@ cd ~/caddy
Create a file named `Caddyfile`:

```bash
nano Caddyfile
vim Caddyfile
```

Add the following configuration (replace the domain):

```caddy
```bash
your-domain.example {
reverse_proxy swarm-gateway:3000
}
Expand Down Expand Up @@ -299,3 +323,20 @@ You can also verify that HTTP is redirected to HTTPS:
curl -I http://your-domain.example/health
```

Example terminal output:

```bash
HTTP/1.1 308 Permanent Redirect
Connection: close
Location: https://your-domain.example/health
Server: Caddy
Date: Mon, 02 Feb 2026 10:31:17 GMT
```

## Part 3 — Options

:::caution
This section is under construction. Further guidance will be available in the near future. For the time being, please join the [#builders channel](https://discord.gg/udBg6ctH) on the Swarm Discord server.
:::

You can find a [list](https://github.com/ethersphere/swarm-gateway/blob/main/README.md#overview) of all available options on the [Swarm Gateway README](github.com/ethersphere/swarm-gateway/blob/main/README.md) on GitHub. [Database options](https://github.com/ethersphere/swarm-gateway/blob/main/README.md#database) can also be set using the DATABASE_CONFIG environment variable.
2 changes: 1 addition & 1 deletion docs/develop/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ This is the go-to starting point for web3 developers who want to build with Swar
</a>
</li>
<li class="hub-card">
<a class="hub-card__link" href="/docs/develop/gateway-proxy">
<a class="hub-card__link" href="/docs/develop/run-a-gateway">
<h3 class="hub-card__title">Run a Gateway</h3>
<p class="hub-card__desc">
Run your own Swarm HTTP gateway to serve content from the network and make it accessible to browsers and other HTTP clients.
Expand Down
6 changes: 3 additions & 3 deletions docs/develop/tools-and-features/gateway-proxy.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Gateway Proxy
id: gateway-proxy
title: Swarm Gateway
id: swarm-gateway
---

The [Swarm Gateway](https://github.com/ethersphere/swarm-gateway) is the standard way to expose a Bee node over HTTP.
Expand Down Expand Up @@ -49,4 +49,4 @@ This is especially useful for gateways that accept uploads from users or applica

## Setting up a Gateway

For a step by step guide on setting up a gateway yourself, refer to the [guide in the Develop on Swarm section](/docs/develop/gateway-proxy/).
For a step by step guide on setting up a gateway yourself, refer to the [guide in the Develop on Swarm section](/docs/develop/run-a-gateway/).
2 changes: 2 additions & 0 deletions docusaurus.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export default {
{ to: '/docs/develop/act', from: '/docs/develop/access-the-swarm/act' },
{ to: '/docs/develop/ultra-light-nodes', from: '/docs/develop/access-the-swarm/ultra-light-nodes' },
{ to: '/docs/develop/introduction', from: '/docs/develop/access-the-swarm' },
{ to: '/docs/develop/run-a-gateway', from: '/docs/develop/gateway-proxy' },

],
},
],
Expand Down
4 changes: 2 additions & 2 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ module.exports = {
'develop/host-your-website',
'develop/files',
'develop/routing',
'develop/gateway-proxy',
'develop/run-a-gateway',
// 'develop/dynamic-content',
'develop/act',
],
Expand All @@ -106,7 +106,7 @@ module.exports = {
'develop/tools-and-features/introduction',
'develop/tools-and-features/buy-a-stamp-batch',
'develop/tools-and-features/bee-js',
'develop/tools-and-features/gateway-proxy',
'develop/tools-and-features/swarm-gateway',
'develop/tools-and-features/chunk-types',
'develop/tools-and-features/feeds',
'develop/tools-and-features/manifests',
Expand Down