Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

@fedify/express: Integrate Fedify with Express

npm Matrix Follow @fedify@hollo.social

This package provides a simple way to integrate Fedify with Express.

The integration code looks like this:

import express from "express";
import { integrateFederation } from "@fedify/express";
import { federation } from "./federation.ts";  // Your `Federation` instance

export const app = express();

app.set("trust proxy", true);

app.use(integrateFederation(federation, (req) => "context data goes here"));

Reverse proxy with Express 4.x

If your application uses Express 4.x behind a reverse proxy with a non-standard port (e.g., Host: example.com:8080), the reconstructed request URL may lose the port number. This is because Express 4.x's req.host (which respects trust proxy) strips the port from the Host header.

This issue does not occur with Express 5.x, where req.host retains the port. If you rely on trust proxy and your origin includes a non-standard port, we recommend upgrading to Express 5.