We recently built and published a small open-source package called shabbat-gate: a Cloudflare Pages/Workers add-on that lets any site actually “rest” during Shabbat and Jewish holidays, without paying a price in Google rankings or AI-search visibility.
What we built
shabbat-gate adds one specific capability to any site: automatically closing itself to human visitors during Shabbat and Israel’s major holidays, showing a responsive Hebrew “site closed” page instead. Meanwhile, search engines and AI crawlers (Google, Bing, GPTBot, ClaudeBot and more) keep getting full around the clock access, so the site’s ranking and search visibility are never hurt.
The project was published in two channels: source code on GitHub (github.com/eyal-meshulam/shabbat-gate) and the actual install via npm (npmjs.com/package/shabbat-gate). There is full documentation in both English and Hebrew, since the primary audience is Israeli, Shabbat-observant site owners.
Who it’s for
Anyone running a site on Cloudflare Pages/Workers who wants their site to actually “rest” during Shabbat and holidays, without hurting organic rankings: Shabbat-observant businesses, community organizations, religious content sites, or any developer who wants to express Shabbat observance digitally too.
How it works, briefly
The logic runs as middleware on every request that hits the site, in this order:
How to install it
The package is free and open source, published on npm as shabbat-gate. The official page is npmjs.com/package/shabbat-gate - that’s where the full documentation of every option lives, alongside the README and CHANGELOG on GitHub.
In an existing Cloudflare Pages project:
npm install shabbat-gate
Then add a functions/_middleware.ts file:
import { createShabbatGate } from 'shabbat-gate';
const gate = createShabbatGate({
siteName: 'My Site Name',
bypassParam: 'preview',
bypassValue: 'letmein-9f3a7c',
});
export const onRequest: PagesFunction = (context) => gate(context);
latitude/longitude are optional (default: Jerusalem, accurate enough for all of Israel at this scale), and renderHoldingPage is optional too, for anyone who wants a completely custom-designed “closed” page.
How to test and debug it
A few tools exist already, so there’s no need to wait for a real Shabbat to test:
- The bypass parameter - the fastest way to check the live site while it’s supposedly closed: visit
?preview=letmein-9f3a7cand see the real site, regardless of the time. wrangler pages dev- runs a local Pages+Functions server that mimics the real Cloudflare environment, to test real requests against the middleware before publishing at all.- Automated tests - 36 vitest tests in the package itself, with no need for a real Cloudflare environment: the bot list, the window-matching algorithm for Shabbat/holidays (including multi-day holidays like Rosh Hashanah, which has two candle-lighting events but only one havdalah), bypass behavior, and especially fail-open - simulating a network failure and confirming the real site still loads.
- Preview of the “closed” page - since
defaultRenderHoldingPageis a pure function, you can call it directly with sample data and see exactly what a visitor will see, without waiting for Friday evening.
Logging - what exists today
Right now there is exactly one error log in the code, at the fail-open point:
console.error('shabbat-gate: failing open due to error', error);
In other words: if the fetch from Hebcal fails or the response is malformed, an error gets logged to the console, and the request continues to the real site. There is currently no success log - not when a visitor gets blocked, and not when they pass through normally - only the exceptional failure case.
On a site actually running on Cloudflare Pages, logs like this are visible via wrangler pages deployment tail (real-time streaming from the terminal), or through the Cloudflare dashboard, under Functions -> Real-time Logs. If more visibility is wanted in the future (for example, counting how many requests actually got blocked), that would be a light addition - but it doesn’t exist today, deliberately: the package stays minimal and only speaks up when there’s a real problem.
Updates since publishing
Since the original post (July 2026) the package has continued to evolve. Highlights:
0.1.3 - safety buffer and a plain-Worker adapter
bufferMinutes- close the site a few minutes before candle-lighting and reopen it a few minutes after havdalah, guarding against clock drift and last-minute browsing right at the boundary.createShabbatGateForWorker- an adapter for plain Cloudflare Worker sites with static assets, not only Pages Functions. That’s exactly how the site you’re reading this on is built.
0.2.0 - blocking by the visitor’s timezone + a localized message
enforceVisitorLocation- until now the gate blocked by Israel’s schedule only, for every visitor worldwide. Now you can also block a visitor by Shabbat in their own location: the site is closed to them if it’s Shabbat in Israel or where they are. A visitor abroad stays blocked from Israel’s candle-lighting through their own local havdalah (holidays reckoned diaspora-style, two-day Yom Tov).- Localized message - for a visitor outside Israel, the “closed” page shows the Hebrew message first, then a message in their browser language below it. Built-in languages: English, French, Russian, Spanish, German and Arabic.
Full documentation of every option is in the README and CHANGELOG on GitHub. Test coverage grew accordingly - 36 vitest tests as of 0.2.0.
Bottom line
shabbat-gate is an example of a small open-source package that solves one specific, clear problem: expressing digital Shabbat observance without paying a price in SEO. The code is short, the tests cover the subtle edge cases, and installing it on an existing site takes just a few lines of code.
Building a site on Cloudflare and want a custom add-on, whether it’s shabbat-gate or something else entirely? Talk to us ↗
