Bouncer for Craft CMS

Lite free · Pro $59 · Craft CMS 5

Who may see what, including the files

Bouncer gates sections, entries, categories and front-end URIs, and the asset files behind them. A plugin that only gates elements leaves the title in the listing and the PDF at its original URL.

Bouncer

A paywall in six lines

Most pages don't need to be all or nothing. Rules gate whole pages on their own; the Twig API gates part of a page. Protected assets need no template changes, because asset.url already returns the guarded route.

twig
{% if craft.bouncer.can(entry) %}
    {{ entry.body }}
{% else %}
    {{ entry.body|teaser(55) }}
    <a href="/subscribe">Read the rest</a>
{% endif %}

{# Unchanged, and now checked on every request #}
<a href="{{ asset.url }}">Download the contract</a>

{# For someone with no account, for an hour #}
{{ craft.bouncer.signedUrl(asset, 3600) }}

Features

Everything a rule can say, and everywhere the answer is enforced.

A rule reads like a sentence

This content, for these people, otherwise that. Target entries by section and type, categories by group, assets by volume, or URIs by glob pattern. Pro can narrow any target with Craft's own element condition builder.

  • Login, user groups (any or all), Craft permissions
  • Pro: shared password, date window, IP allow and deny lists

Rules combine with AND

Every rule that targets an element must pass, so adding a rule can only ever remove access. "Editors or subscribers" goes in one rule's group list. Rule order only decides which response a refused visitor gets.

Listings stop leaking

The query filter hooks every element query, which covers index pages, search, feeds, sitemaps and GraphQL. To list what a visitor can't open ("12 more articles for subscribers"), opt that query out with .bouncer(false).

Files served, not published

Protected assets go through a guarded route that checks access on every request and supports Range and conditional requests. Large files can be handed off to nginx or Apache.

  • Transforms are generated outside the public transform filesystem
  • Remote volumes take a local copy before answering a range

An audit that checks the files

For every volume a rule protects, the exposure audit reports a public filesystem, a public transform filesystem or a local root inside the web root. It gives you the .htaccess or nginx block that closes each one.

Signed links for outsiders

An HMAC-signed, expiring link to one protected file, for someone who has no account. The signature covers the asset, transform, expiry and optionally the user. Nothing is stored on the server.

Six ways to refuse

A refused visitor can be sent to login with a return URL, redirected, shown one of your templates in place, asked for the shared password, or given a plain 403 or 404.

Rules deploy with the site

Rules are stored in project config, so they deploy with the sections they protect and show up in pull-request diffs. Nobody has to re-enter them by hand in production.

It fails closed

An access plugin can't downgrade gracefully, because a lapsed licence that opened the members area would be a breach. On Lite, Pro-only conditions aren't evaluated, and a rule with nothing left to evaluate denies everyone. The control panel names each affected rule.

Check it before you deploy

A rewritten URL doesn't help if the original file can still be fetched, and that is the easiest way to deploy this wrong. The audit exits non-zero when a volume is still exposed or a rule can't be evaluated, so a pipeline that runs it catches both.

bash
php craft bouncer/audit                               # non-zero on an exposed volume or unevaluable rule
php craft bouncer/audit/snippets nginx                # the block that seals each one

php craft bouncer/rules/test /members/handbook                # must refuse
php craft bouncer/rules/test /members/handbook --user-id=5    # must allow

Bouncer in the control panel

The rules in the order they're applied, and the exposure status of every volume they protect.

The Bouncer rules index in the Craft control panel, listing each rule's target, who gets through, and the response a refused visitor sees
The Bouncer Files screen showing each protected volume checked against its filesystem, with a severity and the server snippet that seals it

Screenshots from a live install, not mockups.

Frequently Asked Questions

Questions worth answering before you install it.

Write one rule, then run the audit

Lite is free and covers entries, categories and URIs. Pro is $59 one-off with a $29/year renewal, and adds protected files, signed links, the exposure audit, passwords, date windows and IP rules.