Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: document reverse proxy bug #7478

Merged
merged 1 commit into from
Aug 9, 2020
Merged
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
39 changes: 6 additions & 33 deletions docs/production/reverse-proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ reverse HTTP proxy (usually NGINX). You may need a reverse proxy to:
* Block content.
* Rate limit and timeout requests.
* Apply QoS rules (e.g., prioritize traffic for certain important IPFS resources).
* Expose a limited subset of the HTTP API.

This document contains a collection of tips, tricks, and pitfalls when running a
go-ipfs node behind a reverse HTTP proxy.

**WARNING:** Due to
[nginx#1293](https://trac.nginx.org/nginx/ticket/1293)/[go-ipfs#6402](https://github.com/ipfs/go-ipfs/issues/6402),
parts of the go-ipfs API will not work correctly behind an NGINX reverse proxy
as go-ipfs starts sending back a response before it finishes reading the request
body. The gateway itself is unaffected.

## Peering

Go-ipfs gateways behind a single load balancing reverse proxy should use the
Expand Down Expand Up @@ -45,38 +50,6 @@ you run out of space, instead of garbage collecting.
This will effectively "garbage collect" without actually running the garbage
collector.

# Buffering Requests & Responses

In general, requests to the gateway should be buffered by the reverse proxy for
the best performance. This is usually enabled by default (`proxy_request_buffering`).

## API

The go-ipfs HTTP API (`/api/...`) starts sending a response before it's done
reading the request. This allows it to, e.g., send back progress updates while
adding a file to go-ipfs.

However, these progress updates won't work if the HTTP reverse proxy is
configured to buffer requests. While requests to the go-ipfs _gateway_ should
usually be buffered for better performance, requests to the go-ipfs API should
generally not be buffered.

In NGINX, you can turn off buffering for the API with:

```nginx
server {
...
location /api {
...
proxy_request_buffering off;
proxy_buffering off;
proxy_http_version 1.1;
}
}
```

See: https://github.com/ipfs/go-ipfs/issues/6402#issuecomment-643025868

# Content Blocking

TODO:
Expand Down