# What is an IPFS Gateway?

IPFS HTTP gateways use the HTTP protocol to serve content hosted on the IPFS network, bridging the gap between the two different protocols. This means you can access content on IPFS through its IPFS CID in situations such as code snippets or applications that support HTTP, which most do.

Simply put, a gateway is an IPFS peer that accepts HTTP requests for IPFS CIDs.

The IPFS HTTP gateway format follows the structure:

<figure><img src="https://3861818989-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lyjw7dWpiQtUFDa1pO0%2Fuploads%2Fq1SqzGag49C1dKKtHLa6%2Fimage.png?alt=media&#x26;token=7efee13d-42a6-4b5f-8eef-744d5f5106f8" alt=""><figcaption></figcaption></figure>

### IPFS Public Gateways <a href="#ipfs-public-gateways" id="ipfs-public-gateways"></a>

All content stored on IPFS through Filebase can be accessed through the Filebase gateway with faster response times than accessing the content through any other gateway. This is because the Filebase gateway peers with our IPFS nodes. The Filebase gateway also peers with the IPFS gateways of other pinning services.

{% hint style="info" %}
The Filebase public IPFS gateway is:

`https://ipfs.filebase.io/ipfs/<CID>`
{% endhint %}

{% hint style="danger" %}
The Filebase Public IPFS Gateway has an effective rate limit of 200 RPM (requests per minute).

The Filebase Public IPFS Gateway only serves content stored on Filebase.
{% endhint %}

Gateways can serve the CID of a folder instead of just a single file. In this scenario, it will return a file directory tree that contains the files located in the folder.

For example, the following IPFS gateway URL leads to a folder directory of files:

`https://ipfs.filebase.io/ipfs/QmWTqpfKyPJcGuWWg73beJJiL6FrCB5yX8qfcCF4bHvane`

Gateways can also be used to serve static websites. The following URL leads to a static webpage, hosted on IPFS using a folder containing a static HTML file and image files:

`https://ipfs.filebase.io/ipfs/QmYRpH3myNKG2XeaBmdidec3R5HcF9PYBHUVHfks5ysTpq/`

### Public IPFS Gateways vs Private IPFS Gateways <a href="#public-ipfs-gateways-vs-private-ipfs-gateways" id="public-ipfs-gateways-vs-private-ipfs-gateways"></a>

Public gateways allow anyone to use HTTP to retrieve CIDs from the IPFS network. Filebase offers a public IPFS gateway with the following address:

`https://ipfs.filebase.io/ipfs/<CID>/`

There are two forms of private IPFS gateways: dedicated and self-hosted.

Dedicated gateways are offered by IPFS pinning services that allow you to access the CIDs pinned on IPFS through the pinning service through your own private dedicated gateway. Dedicated gateways are typically not limited to traditional rate limits that public gateways are.

Self-hosted gateways refer to an IPFS node that you host yourself, either in the cloud or on your local machine, that is configured to act as an IPFS gateway. Self-hosted gateways are not limited to rate limits either, but require IPFS to be running and managed by you for functionality. Many users choose an IPFS pinning service that offers dedicated gateways so they can avoid hosting and maintaining IPFS nodes themselves.

#### IPFS HTTP Gateway Process <a href="#ipfs-http-gateway-process" id="ipfs-http-gateway-process"></a>

<figure><img src="https://3861818989-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lyjw7dWpiQtUFDa1pO0%2Fuploads%2FNq7MJk47mvUKTW2v1M4O%2Fimage.png?alt=media&#x26;token=166f6dad-061f-4e2b-9380-18dec8050883" alt=""><figcaption></figcaption></figure>

When a request for a CID is initiated using an IPFS HTTP gateway, the following steps occur:

1. The gateway checks if the CID has been cached locally before it attempts to retrieve it from the IPFS network. The cache can either be the local HTTP cache, or the cache of the IPFS gateway node.
2. If the CID hasn’t been cached, the CID will need to be retrieved from the IPFS network.
3. The IPFS peer will first ask its direct peers if any of them are hosting the requested CID, then it will query the DHT to find peer IDs and network addresses of peers that are currently hosting or pinning the requested CID.
4. The IPFS gateway node will connect to one of the peers with the CID, fetch the CID’s content, then relay the response to the client that requested the CID.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.filebase.com/ipfs-concepts/what-is-an-ipfs-gateway.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
