GitHub - ahmed-debbech/mastgate: A Fediverse Relay Filter · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
ahmed-debbech
mastgate
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star
master
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>2 Commits<br>2 Commits
.screenshots
.screenshots
views
views
.env.sample
.env.sample
.gitignore
.gitignore
Dockerfile
Dockerfile
LICENSE
LICENSE
NOTICE
NOTICE
README.md
README.md
cache.js
cache.js
db_api.js
db_api.js
db_services.js
db_services.js
docker-compose.yaml
docker-compose.yaml
face.js
face.js
logic.js
logic.js
package.json
package.json
proxy.js
proxy.js
router.js
router.js
View all files
Repository files navigation
Mastgate - Fediverse Relay Filter
What is this?
This is a simple proxy that filters federated content coming from relays, either pass it to your Mastodon instance or reject it. Based on the remote instance hostname.
Motivation
Most of the relays traffic i don't care about.
My mastodon instance's storage is always full of content i don't care about, i want to save space for only what matters to me.
How does it look like?
How to use it?
1 - Run cp .env.sample .env
2 - Set your mastodon instance URL in .env
3 - Forward the Mastodon instance's traffic to Mastgate (if you already use a reverse proxy).
4 - Run docker compose up -d to start
5 - Go to http://mastgate_ip:port/mastgate to configure what relays to expect traffic from, usually the ones you configured in you own instance.
Also set the allowed instances that their traffic is coming from the relays.
TL;DR: The relays configured are the ones Mastgate consider to filter their traffic based on the allowed domains set, in other words Mastgate is only aware of the traffic that is coming from configured relays. Everything else is forwarded immediately to your instance.
How Mastgate does the filtering?
1 - Mastgate filters whatever hitting your /inbox endpoint of your instance which accepts federated traffic.
2 - Mastgate then checks if the Signature header contains one of the relay names.
3 - If yes, Mastgate checks the body of the request and determines the actor field and checks if the remote server name of the actor is allowed.
4 - If yes, it gets forwarded to your instance. If no, it is rejected and never reaches your instance.
A work in progress by Ahmed Debbech.
About
A Fediverse Relay Filter
Resources
Readme
License
Apache-2.0 license
Uh oh!
There was an error while loading. Please reload this page.
Activity
Stars
stars
Watchers
watching
Forks
forks
Report repository
Releases
v0.1
Latest
Jul 5, 2026
Packages
Uh oh!
There was an error while loading. Please reload this page.
Contributors
Uh oh!
There was an error while loading. Please reload this page.
Languages
JavaScript<br>56.0%
EJS<br>41.4%
Dockerfile<br>2.6%
You can’t perform that action at this time.