···4455# Porxie
6677-A correct and efficient ATProto blob proxy for secure content delivery.
77+A correct and efficient ATProtocol blob proxy for secure content delivery.
8899</div>
1010···1414- Secure serving: blobs are always served with secure headers to help improve end-user security.
1515- MIME filtering: detects blob content MIME-types and enforces an optional allowlist of permitted types.
1616- Policy enforcement: optionally integrate with an external policy service (like an AppView) to control which blobs can be served.
1717-- In-memory cache: configurable in-memory caching for fast repeat access with support for manual cache purging via authenticated HTTP DELETE.
1717+- In-memory cache: configurable in-memory caching for fast repeat access with support for manual cache purging.
18181919## Usage
2020···30303131### Run: Binary
32323333-To run Porxie directly, install [Rust and Cargo](https://rust-lang.org/tools/install/) and then:
3333+To run Porxie as a binary, you'll first need to install it locally.
34343535-1. Install the binary:
3535+As Porxie is not packaged or pre-built in many places yet, the easiest way to do this is building it via Cargo directly. Ensure you have a relatively up to date version of [Rust and Cargo](https://rust-lang.org/tools/install/) installed before following these steps:
3636+3737+1. Install the binary, replacing v0.0.0 with the version you want to install:
36383739 ```sh
3838- cargo install --git https://codeberg.org/Blooym/porxie.git
4040+ cargo install --git https://codeberg.org/Blooym/porxie.git#v0.0.0 porxie
3941 ```
404241432. Run the server with your chosen [configuration](#configuration) options:
···4446 porxie
4547 ```
46484747-### Run: Docker Compose
4949+### Run: Docker / Containers
5050+5151+Porxie is available as a pre-built container image on [DockerHub](https://hub.docker.com/r/blooym/porxie) and can be used with whatever container setup you use. The published image runs a statically linked binary in a `scratch` environment as a non-root user by default.
48524949-To run Porxie with Docker Compose, you can start with the following `compose.yml` template:
5353+You can use the following `compose.yml` template as a starting point, adding any [configuration](#configuration) options as environment variables:
50545155```yaml
5256services:
···6266 - no-new-privileges
6367```
64686565-### Run: Nix
6969+### Run: Nix / NixOS Service
66706767-To run Porxie with Nix, you can use the [package](https://search.nixos.org/packages?channel=unstable&query=porxie) or [NixOS module](https://search.nixos.org/options?channel=unstable&query=porxie) provided directly in nixpkgs.
7171+To run Porxie with Nix, you can either use the [package](https://search.nixos.org/packages?channel=unstable&query=porxie) directly or the [NixOS module](https://search.nixos.org/options?channel=unstable&query=porxie), both of which are provided directly in nixpkgs. Please refer to the Nix search page for NixOS service options.
68726973## Routes
70747175- [GET] `/{did}/{cid}`: Fetch a blob either from cache or origin.
7272-- [GET] `/xrpc/dev.blooym.porxie.getBlob?did=<did>&cid=<cid>`: XRPC Compatibility alias for the fetch blob endpoint.
7676+- [GET] `/xrpc/dev.blooym.porxie.getBlob?did=<did>&cid=<cid>`: XRPC Compatibility shim for the fetch blob endpoint.
7377- [POST] `/xrpc/dev.blooym.porxie.cache.purgeActor?did=<did>`: Purge all cached items relating to an actor DID.
7478- [POST] `/xrpc/dev.blooym.porxie.cache.purgeBlob?cid=<cid>`: Purge all cache items relating to a blob CID.
7575-76797780## Policy Service
78817979-Porxie can optionally check with an external HTTP service before serving any blob. You build and run this service yourself - Porxie just calls it and acts on the response. This is useful for things like content takedowns or blob allow lists.
8080-8181-For every incoming request, Porxie sends `GET <policy-service-url>/xrpc/dev.blooym.porxie.getBlobPolicy` and expects a response that conforms to the (`lexicon xrpc output`)[lexicons/dev/blooym/porxie/getBlobPolicy.json].
8282+Porxie can check with an external HTTP "policy" service before serving blobs, which is useful for moderating content or only serving specific content. You build and run this service yourself - Porxie just sends requests to an XRPC endpoint at [`/xrpc/dev.blooym.porxie.getBlobPolicy`](lexicons/dev/blooym/porxie/getBlobPolicy.json) and acts on the response accordingly.
82838383-Policy decisions are cached per DID+CID pair, so your service won't be hit on every request. The policy cache can be cleared for a blob or actor via the cache clearing xrpc endpoints.
8484+Policy decisions will be cached using the request DID+CID by default to reduce load on the policy service. The duration items are cached can be configured, and the cache can be cleared manually for a blob or actor via the relevant endpoint.
84858585-By default, Porxie will fail-closed: if the policy service errors, the blob request fails too. This can be changed to fail-open if preferred.
8686+By default, Porxie will fail-closed: if the policy service returns an error is otherwise unavailable, the blob request will fail too. This behaviour can be configured to fail-open if availability is more important than applying policies.
86878788See the [Configuration](#configuration) section for all available policy options.
8889
+1-1
crates/porxie/Cargo.toml
···11[package]
22name = "porxie"
33-description = "A correct and efficient ATProto blob proxy for secure content delivery."
33+description = "A correct and efficient ATProtocol blob proxy for secure content delivery."
44authors = ["Blooym"]
55repository = "https://codeberg.org/Blooym/porxie"
66homepage = "https://codeberg.org/Blooym/porxie/src/branch/main/README.md"
+1-1
crates/porxie/src/types/blob_cid.rs
···11-// TODO: Transfer this implementation to a standalone ATProto types crate in the future.
11+// TODO: Transfer this implementation to a standalone ATProtocol types crate in the future.
2233use cid::Version;
44use serde::Serialize;
+1-1
flake.nix
···11{
22- description = "Porxie, an ATProto blob proxy for secure content delivery";
22+ description = "Porxie, an ATProtocol blob proxy for secure content delivery";
3344 inputs = {
55 nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";