<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: InstaTunnel</title>
    <description>The latest articles on DEV Community by InstaTunnel (@instatunnel).</description>
    <link>https://dev.to/instatunnel</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3795996%2Fb19f9bd7-1698-4edc-820f-0f7807ac54a8.png</url>
      <title>DEV Community: InstaTunnel</title>
      <link>https://dev.to/instatunnel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/instatunnel"/>
    <language>en</language>
    <item>
      <title>Sign in with Apple Needs a Real Domain: Return URLs and Testing Through a Tunnel</title>
      <dc:creator>InstaTunnel</dc:creator>
      <pubDate>Sat, 28 Nov 2026 01:42:56 +0000</pubDate>
      <link>https://dev.to/instatunnel/sign-in-with-apple-needs-a-real-domain-return-urls-and-testing-through-a-tunnel-5di7</link>
      <guid>https://dev.to/instatunnel/sign-in-with-apple-needs-a-real-domain-return-urls-and-testing-through-a-tunnel-5di7</guid>
      <description>&lt;p&gt;If you have wired up Google or GitHub login, you probably tested it on &lt;code&gt;http://localhost:3000&lt;/code&gt; without a second thought. Then you tried Sign in with Apple, and the flow fell apart. There is no localhost return URL to register, some errors are not very specific, and the usual workaround is to put a tunnel such as ngrok in front of your dev server.&lt;/p&gt;

&lt;p&gt;That workaround works, but it skips the part that costs you time: every time your tunnel URL changes, the entry you created in the Apple Developer portal is wrong again. This guide explains why Sign in with Apple needs a public HTTPS domain, what you must register, how to test through a tunnel, and why a stable subdomain turns a recurring chore into a one-time setup.&lt;/p&gt;

&lt;p&gt;It covers the &lt;strong&gt;OAuth 2.0 / OpenID Connect web flow&lt;/strong&gt; (Services ID, return URLs, &lt;code&gt;form_post&lt;/code&gt; callbacks), not native iOS sign-in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick answers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Can I use &lt;code&gt;http://localhost&lt;/code&gt; as a return URL?&lt;/strong&gt; In practice, no. Apple’s documentation requires each return URL to be absolute (scheme, host and path) and shows an &lt;code&gt;https://&lt;/code&gt; example. Okta’s walkthrough and one PHP client’s FAQ both report that Apple rejects localhost.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Does &lt;code&gt;127.0.0.1&lt;/code&gt; work?&lt;/strong&gt; Okta reports that an IP address like this can be entered but fails later in the flow.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do I still need to upload a verification file?&lt;/strong&gt; Apple’s current help page says you don’t need to upload a file to register domains and subdomains.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easiest local test?&lt;/strong&gt; Expose your dev server through an HTTPS tunnel, and register a hostname that stays the same between restarts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why localhost does not work
&lt;/h2&gt;

&lt;p&gt;Apple’s documentation says the Sign in with Apple servers use return URLs (also called redirect URIs) to deliver the authorization response or to validate tokens. Because of that, each registered URL must be absolute and include the scheme, host and path. Apple’s example is &lt;code&gt;https://example.com/path/to/endpoint&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Apple’s pages don’t spell out a localhost ban, so the rule comes from third parties. Okta’s 2019 walkthrough says Apple doesn’t allow &lt;code&gt;localhost&lt;/code&gt; URLs in the registration step and that an IP address like &lt;code&gt;127.0.0.1&lt;/code&gt; fails later in the flow. An Apple Developer Forums thread about registering &lt;code&gt;http://localhost/oauth2/apple&lt;/code&gt; quotes that passage. Treat that thread as a developer’s question quoting Okta, not as an Apple ruling. A PHP client library’s FAQ (last released in 2020) agrees: it says Apple doesn’t allow localhost or non-HTTPS redirect URLs even during testing, and suggests a tunnel such as ngrok or a redirect-intercepting browser extension.&lt;/p&gt;

&lt;p&gt;Either way, the plan is the same: use a public HTTPS hostname from day one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What you must register
&lt;/h2&gt;

&lt;p&gt;The web flow needs four things in Certificates, Identifiers &amp;amp; Profiles:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A primary App ID&lt;/strong&gt; with Sign in with Apple enabled. Apple’s documentation describes the web service as being associated with an existing app that uses Sign in with Apple.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Services ID&lt;/strong&gt;, which is your OAuth &lt;code&gt;client_id&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website URLs&lt;/strong&gt; on the Services ID: your domain or subdomain, plus the return URL.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A private key&lt;/strong&gt; (&lt;code&gt;.p8&lt;/code&gt;) tied to the primary App ID, used to sign your client secret. Each primary app can have at most two private keys, and you can download the file only once.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The most common mistake is the &lt;code&gt;client_id&lt;/code&gt;. For web requests Apple expects the &lt;strong&gt;Services ID&lt;/strong&gt;, not the iOS App ID. In a forum thread about a rejected &lt;code&gt;redirect_uri&lt;/code&gt;, an Apple staff reply explained that the primary app’s ID has no return URLs registered, so a request that carries one fails validation. Auth0’s support article lists the same cause for &lt;code&gt;invalid_request Invalid web redirect url&lt;/code&gt;, alongside a wrong redirect URI in the Apple settings.&lt;/p&gt;

&lt;p&gt;You can register up to 10 website URLs per Services ID as an individual, or 100 as an organization. That cap matters once random tunnel hostnames enter the picture.&lt;/p&gt;

&lt;h2&gt;
  
  
  Domain verification: the old file is gone
&lt;/h2&gt;

&lt;p&gt;Older tutorials tell you to host &lt;code&gt;apple-developer-domain-association.txt&lt;/code&gt; under &lt;code&gt;/.well-known/&lt;/code&gt;. Forum threads from that period show “Verification failed for domain” errors. Reported causes include a redirect from the apex domain to &lt;code&gt;www&lt;/code&gt;, and a stale file (one reply relayed Apple support saying a downloaded file was valid for only 7 days).&lt;/p&gt;

&lt;p&gt;That workflow is outdated. Apple’s current help page says you don’t need to upload a file on your server to register domains and subdomains, and developers who configured Sign in with Apple more recently report finding no download link at all. One caveat: Apple’s separate configuration article still says you must register and verify your domains, so treat the help page as the current instruction for the portal steps.&lt;/p&gt;

&lt;p&gt;Two details trip people up in the Website URLs field:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enter &lt;strong&gt;domains and subdomains without a scheme&lt;/strong&gt;: &lt;code&gt;myapp-auth.instatunnel.my&lt;/code&gt;. Replit’s guide gives the same instruction.&lt;/li&gt;
&lt;li&gt;Enter &lt;strong&gt;return URLs with scheme and path&lt;/strong&gt;: &lt;code&gt;https://myapp-auth.instatunnel.my/auth/apple/callback&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Apple says to provide domains, subdomains and return URLs as comma-delimited lists, and that at least one domain or subdomain is required.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup, step by step
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Choose your public hostname first.&lt;/strong&gt; Changing it later means editing the Services ID again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enable the capability&lt;/strong&gt; on your primary App ID.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create a Services ID&lt;/strong&gt; with a reverse-DNS identifier such as &lt;code&gt;com.example.web&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configure Sign in with Apple&lt;/strong&gt; on it: select the primary App ID, then add the subdomain and return URL.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create a key&lt;/strong&gt; with Sign in with Apple enabled, tied to the primary App ID. Download the &lt;code&gt;.p8&lt;/code&gt; file and note the Key ID. Treat it like a production secret.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Collect four values:&lt;/strong&gt; Team ID, Services ID, Key ID, and the key contents.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The tunnel problem: random URLs mean constant re-registration
&lt;/h2&gt;

&lt;p&gt;Developers have made Sign in with Apple work through ngrok by registering the tunnel hostname in the Services ID and using the matching redirect URI in their code, as one forum thread describes. The catch appears with tunnels that hand out a new random hostname on each run:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You start the tunnel and get &lt;code&gt;a1b2c3.tunnel.example&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You edit the Services ID in the portal, add the hostname and return URL, and save.&lt;/li&gt;
&lt;li&gt;You update &lt;code&gt;redirect_uri&lt;/code&gt; in your environment file.&lt;/li&gt;
&lt;li&gt;Tomorrow the tunnel restarts, and all of it is wrong again.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Unless you prune old entries, each cycle adds another one, and the 10 or 100 URL cap fills with dead hostnames. When the hostname is the only thing that changed between a working run and a broken one, you can chase the wrong cause for an hour.&lt;/p&gt;

&lt;p&gt;A tunnel with a persistent subdomain removes the problem at the source.&lt;/p&gt;

&lt;h2&gt;
  
  
  A better workflow: register one stable subdomain, once
&lt;/h2&gt;

&lt;p&gt;Here is the flow with InstaTunnel as the example. Install the CLI and request a fixed subdomain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install -g instatunnel
instatunnel 3000 --subdomain myapp-auth
&lt;span class="c"&gt;# Tunnel created: https://myapp-auth.instatunnel.my&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;InstaTunnel’s package README lists custom subdomains, 24+ hour sessions and three simultaneous tunnels on the free tier. It also describes a &lt;code&gt;--logs&lt;/code&gt; option for live request logs. Check the pricing page before relying on specific limits, since plans change. What matters here is that you can request the same &lt;code&gt;--subdomain&lt;/code&gt; every time, provided the name is available to you.&lt;/p&gt;

&lt;p&gt;Register it once in the portal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Domain/subdomain:&lt;/strong&gt; &lt;code&gt;myapp-auth.instatunnel.my&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Return URL:&lt;/strong&gt; &lt;code&gt;https://myapp-auth.instatunnel.my/auth/apple/callback&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After that, restarting the tunnel changes nothing Apple knows about. Your &lt;code&gt;.env&lt;/code&gt; and Services ID stay put. Two habits help: use one subdomain per project, and if you ever release a subdomain, remove it from the Services ID so a hostname you no longer control is not left on the allowed list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building the callback
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Request authorization
&lt;/h3&gt;

&lt;p&gt;Apple’s endpoint is &lt;code&gt;https://appleid.apple.com/auth/authorize&lt;/code&gt;. If you request the &lt;code&gt;name&lt;/code&gt; or &lt;code&gt;email&lt;/code&gt; scope, you must set &lt;code&gt;response_mode=form_post&lt;/code&gt;. An Apple forum post says that without it you get an error about missing or unsupported parameters or an invalid redirect URL.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//appleid.apple.com/auth/authorize&lt;/span&gt;
  &lt;span class="na"&gt;?client_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;web&lt;/span&gt;
  &lt;span class="na"&gt;&amp;amp;redirect_uri&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;3A&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;2F&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;2Fmyapp&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;instatunnel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;my&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;2Fauth&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;2Fapple&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;2Fcallback&lt;/span&gt;
  &lt;span class="na"&gt;&amp;amp;response_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mi"&gt;20id_token&lt;/span&gt;
  &lt;span class="na"&gt;&amp;amp;scope&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="mf"&gt;20email&lt;/span&gt;
  &lt;span class="na"&gt;&amp;amp;response_mode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;form_post&lt;/span&gt;
  &lt;span class="na"&gt;&amp;amp;state&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;RANDOM_STATE&lt;/span&gt;
  &lt;span class="na"&gt;&amp;amp;nonce&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="no"&gt;RANDOM_NONCE&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Accept a POST, not a GET
&lt;/h3&gt;

&lt;p&gt;With &lt;code&gt;form_post&lt;/code&gt;, Apple sends an HTTP POST with an &lt;code&gt;application/x-www-form-urlencoded&lt;/code&gt; body to your return URL. Many callbacks only read the query string and receive nothing. The &lt;code&gt;user&lt;/code&gt; field, when present, is a JSON string. In Express:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"express"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;urlencoded&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;extended&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/auth/apple/callback"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;id_token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// `user` (first authorization only) is a JSON string: JSON.parse it&lt;/span&gt;
  &lt;span class="c1"&gt;// and sanitize the names before storing.&lt;/span&gt;
  &lt;span class="c1"&gt;// Check `state`, exchange `code` at /auth/token,&lt;/span&gt;
  &lt;span class="c1"&gt;// then verify id_token (issuer, audience, signature, nonce).&lt;/span&gt;
  &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;redirect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Apple says the authorization &lt;code&gt;code&lt;/code&gt; is single-use and valid for five minutes.&lt;/p&gt;

&lt;p&gt;This POST arrives cross-site, and browsers do not send &lt;code&gt;SameSite=Lax&lt;/code&gt; cookies on cross-site POST requests. A session cookie holding your &lt;code&gt;state&lt;/code&gt; may therefore be missing. Mark that cookie &lt;code&gt;SameSite=None; Secure&lt;/code&gt;, or keep state server-side. Chrome has had a temporary two-minute exception for cookies set without any &lt;code&gt;SameSite&lt;/code&gt; attribute, but it is slated for removal, so don’t build on it.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Generate the client secret
&lt;/h3&gt;

&lt;p&gt;Apple has no static secret. You sign a JWT with your &lt;code&gt;.p8&lt;/code&gt; key using ES256, as Okta’s explainer and Microsoft’s Azure docs describe: Team ID as issuer, Services ID as subject, &lt;code&gt;https://appleid.apple.com&lt;/code&gt; as audience, and the Key ID in the &lt;code&gt;kid&lt;/code&gt; header. Apple does not accept an expiration more than six months out.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;SignJWT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;importPKCS8&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"jose"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;appleClientSecret&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;importPKCS8&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;APPLE_PRIVATE_KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"ES256"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;SignJWT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setProtectedHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;alg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ES256"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;kid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;APPLE_KEY_ID&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setIssuer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;APPLE_TEAM_ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setSubject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;APPLE_SERVICES_ID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setAudience&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://appleid.apple.com"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setIssuedAt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setExpirationTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"30d"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Exchange the code
&lt;/h3&gt;

&lt;p&gt;POST the code to &lt;code&gt;https://appleid.apple.com/auth/token&lt;/code&gt;. Okta’s walkthrough notes that Apple requires a &lt;code&gt;User-Agent&lt;/code&gt; header on that request and returns a 403 without one, so set one if your HTTP client doesn’t. The ID token’s issuer is &lt;code&gt;https://appleid.apple.com&lt;/code&gt;. Apple publishes its signing keys at &lt;code&gt;https://appleid.apple.com/auth/keys&lt;/code&gt;; the endpoint can return several keys, so pick the one whose &lt;code&gt;kid&lt;/code&gt; matches the token header. Validate issuer, audience (your Services ID), expiry, signature and nonce.&lt;/p&gt;

&lt;h2&gt;
  
  
  A quick end-to-end test checklist
&lt;/h2&gt;

&lt;p&gt;Once the tunnel is running, walk the flow in this order so a failure points at one layer:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;code&gt;https://myapp-auth.instatunnel.my&lt;/code&gt; in a browser and confirm your dev server answers over HTTPS.&lt;/li&gt;
&lt;li&gt;Click your Sign in with Apple button and confirm the Apple sign-in page loads. If you get &lt;code&gt;invalid_request&lt;/code&gt; here, suspect registration (Services ID, return URL, &lt;code&gt;client_id&lt;/code&gt;) before your callback code.&lt;/li&gt;
&lt;li&gt;Complete sign-in and confirm a POST reaches &lt;code&gt;/auth/apple/callback&lt;/code&gt;. Your tunnel’s request log (InstaTunnel’s &lt;code&gt;--logs&lt;/code&gt;, for example) shows whether Apple’s request arrived at all.&lt;/li&gt;
&lt;li&gt;Confirm &lt;code&gt;state&lt;/code&gt; matches the stored value, then check the code exchange response from &lt;code&gt;/auth/token&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Decode the ID token and check issuer, audience and nonce.&lt;/li&gt;
&lt;li&gt;Repeat with a fresh first-time authorization to confirm you capture name and email once.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Gotchas that waste the most time
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The &lt;code&gt;user&lt;/code&gt; object arrives once.&lt;/strong&gt; Apple returns it, with the name and email, only the first time someone authorizes your app. The email is also in the ID token on every request. To repeat a true first sign-in, revoke the app in your Apple Account’s Sign in with Apple settings, as Okta’s walkthrough describes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Names come from the POST body, not the ID token.&lt;/strong&gt; Apple says it doesn’t receive the full name, so the name is not in the identity token. Sanitize it before storing. The email may be a private relay address; if you send mail to it, Apple’s docs say to register your outbound email domains.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do not require an email.&lt;/strong&gt; Replit’s guide warns that in some regions, including China and India, Apple IDs may be tied to phone numbers instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;“Invalid web redirect url” has a short checklist.&lt;/strong&gt; Auth0’s support article names two causes: the redirect URI in the Apple settings is wrong, or the &lt;code&gt;client_id&lt;/code&gt; is the App ID instead of the Services ID. Also check that the registered return URL matches what you send in every part (scheme, host, path), that it includes &lt;code&gt;https://&lt;/code&gt; (a forum reply reports that a missing scheme left the popup flow stuck), and that you updated the portal after changing a tunnel hostname.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Popup flow:&lt;/strong&gt; developers in one forum thread report that with Apple’s JS SDK popup, the redirect URI must use the same fully qualified domain as the page that opens the popup. Browse your app through the tunnel hostname, not localhost.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apple has a troubleshooting guide.&lt;/strong&gt; TN3107, “Resolving Sign in with Apple response errors,” explains &lt;code&gt;invalid_request&lt;/code&gt;, &lt;code&gt;invalid_client&lt;/code&gt; and &lt;code&gt;invalid_grant&lt;/code&gt;. Apple’s DTS engineers have also said server logs are purged periodically, so reproduce the failure recently before contacting them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A secret can fail early.&lt;/strong&gt; One thread reports &lt;code&gt;INVALID_CLIENT&lt;/code&gt; that cleared only after regenerating the client secret, though the six-month limit had not passed. Apple’s engineer asked for more information rather than giving a cause, so treat a fresh secret as a cheap first test, not a diagnosis.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apple-side incidents happen.&lt;/strong&gt; In June 2025, a configuration issue on Apple’s side caused &lt;code&gt;invalid_client&lt;/code&gt; responses for some developer accounts that created or edited app or Services ID configurations. Apple marked it resolved. If a setup that matches the documentation fails right after you edit the Services ID, check Apple’s developer forums and system status.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Security when testing through a tunnel
&lt;/h2&gt;

&lt;p&gt;A tunnel puts your dev server on the public internet. Always validate &lt;code&gt;state&lt;/code&gt; and &lt;code&gt;nonce&lt;/code&gt;, since a public callback invites forged requests. Keep the &lt;code&gt;.p8&lt;/code&gt; out of version control; Apple says never to share private keys outside your developer team, and to create a new key and revoke the old one if it is compromised. Consider a separate Services ID for development so test hostnames never sit on your production allowed list. Stop the tunnel when you are not testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  When a tunnel is the wrong tool
&lt;/h2&gt;

&lt;p&gt;Native iOS and macOS apps use the system sign-in flow and their own App ID rather than web return URLs; a forum thread shows an iOS app’s token audience being the App ID while the web flow’s is the Services ID. For staging, consider a real staging domain on its own Services ID. For CI end-to-end tests, consider mocking Apple’s endpoints instead of calling the live service.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Can I register more than one return URL?&lt;/strong&gt; Yes: up to 10 website URLs for individuals and 100 for organizations, per Services ID.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is my callback body empty?&lt;/strong&gt; You are likely missing the URL-encoded body parser. With &lt;code&gt;form_post&lt;/code&gt;, results arrive in the POST body.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How often must I rotate the client secret?&lt;/strong&gt; Apple rejects secrets that expire more than six months out. If you pre-generate a long-lived secret, regenerate it at least every six months. If you sign a fresh short-lived one in code, as in the example above, there is nothing to rotate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Sign in with Apple’s web flow is strict: a Services ID as the client, absolute HTTPS return URLs, a self-signed JWT as the secret, and a POST callback. That strictness is why localhost fails and why test setups break on details other providers forgive. Pick a stable public hostname, register it once, handle &lt;code&gt;form_post&lt;/code&gt; and cookies correctly, and the Apple portal becomes something you configure on day one and then leave alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/help/account/capabilities/configure-sign-in-with-apple-for-the-web" rel="noopener noreferrer"&gt;Configure Sign in with Apple for the web (Apple Developer Help)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/documentation/signinwithapple/configuring-your-environment-for-sign-in-with-apple.md" rel="noopener noreferrer"&gt;Configuring your environment for Sign in with Apple (Apple)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/tutorials/data/documentation/signinwithapplerestapi/request-an-authorization-to-the-sign-in-with-apple-server..md" rel="noopener noreferrer"&gt;Request an authorization to the Sign in with Apple server (Apple)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/documentation/signinwithapplerestapi/fetch-apple's-public-key-for-verifying-token-signature.md" rel="noopener noreferrer"&gt;Fetch Apple’s public key to verify token signatures (Apple)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/documentation/technotes/tn3107-resolving-sign-in-with-apple-response-errors.md" rel="noopener noreferrer"&gt;TN3107: Resolving Sign in with Apple response errors (Apple)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/forums/thread/696055" rel="noopener noreferrer"&gt;Set localhost as return URL (Apple Developer Forums)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/forums/thread/121760" rel="noopener noreferrer"&gt;Use response_mode = form_post when requesting name or email scope (Apple Developer Forums)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/forums/thread/129957" rel="noopener noreferrer"&gt;Stuck in Sign in With Apple modal flow, ngrok testing (Apple Developer Forums)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/forums/thread/122536" rel="noopener noreferrer"&gt;Invalid redirect_uri with a registered URL (Apple Developer Forums)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/forums/thread/747744" rel="noopener noreferrer"&gt;Conditions under which a JWT client token expires (Apple Developer Forums)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/forums/thread/122124" rel="noopener noreferrer"&gt;Apple Sign In - Verification failed for domain (Apple Developer Forums)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/forums/thread/719985" rel="noopener noreferrer"&gt;Is it normal that I was able to set up Sign In With Apple without verifying the domain? (Apple Developer Forums)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/forums/thread/790827" rel="noopener noreferrer"&gt;Sign in with Apple Service Outage, June 2025 (Apple Developer Forums)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://community.auth0.com/t/invalid-web-redirect-url-error-with-sign-in-with-apple/106556" rel="noopener noreferrer"&gt;Invalid Web Redirect URL Error with Sign In with Apple (Auth0 Community)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.okta.com/blog/2019/06/04/what-the-heck-is-sign-in-with-apple" rel="noopener noreferrer"&gt;What the Heck is Sign In with Apple? (Okta Developer)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/app-service/configure-authentication-provider-apple" rel="noopener noreferrer"&gt;Configure Sign in with Apple provider (Microsoft Learn)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.replit.com/features/auth-and-identity/sign-in-providers.md" rel="noopener noreferrer"&gt;Sign-in providers: Apple (Replit Docs)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://packagist.org/packages/currencyfair/apple-sign-in-php-client" rel="noopener noreferrer"&gt;apple-sign-in-php-client FAQ (Packagist)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://andrewlock.net/understanding-samesite-cookies" rel="noopener noreferrer"&gt;Understanding SameSite cookies (Andrew Lock)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://simonwillison.net/2021/Aug/3/samesite/" rel="noopener noreferrer"&gt;Exploring the SameSite cookie attribute for preventing CSRF (Simon Willison)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://app.unpkg.com/instatunnel@1.1.3/files/README.md" rel="noopener noreferrer"&gt;InstaTunnel package README (unpkg)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://instatunnel.my/blog/sign-in-with-apple-needs-a-real-domain-return-urls-and-testing-through-a-tunnel" rel="noopener noreferrer"&gt;https://instatunnel.my/blog/sign-in-with-apple-needs-a-real-domain-return-urls-and-testing-through-a-tunnel&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
    </item>
    <item>
      <title>The Webhook Allowlist That Went Stale: Provider IP Ranges Change Under You</title>
      <dc:creator>InstaTunnel</dc:creator>
      <pubDate>Fri, 27 Nov 2026 01:43:10 +0000</pubDate>
      <link>https://dev.to/instatunnel/the-webhook-allowlist-that-went-stale-provider-ip-ranges-change-under-you-80</link>
      <guid>https://dev.to/instatunnel/the-webhook-allowlist-that-went-stale-provider-ip-ranges-change-under-you-80</guid>
      <description>&lt;p&gt;Your webhook endpoint worked for two years. Then deliveries stop arriving, the provider dashboard shows failures, and nothing in your code has changed. The culprit is often a firewall rule you wrote once and forgot: a webhook IP allowlist that no longer matches where the provider actually sends from.&lt;/p&gt;

&lt;p&gt;In 2026, GitHub, Twilio and SendGrid have each published changes that touch the addresses webhooks come from. This article covers what changed, how to keep a GitHub allowlist current with the Meta API, why signature checks are the stronger control, and how to test the whole path through a tunnel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GitHub added three webhook delivery ranges to the &lt;code&gt;hooks&lt;/code&gt; field of its Meta API, announced on October 29, 2026.&lt;/li&gt;
&lt;li&gt;Twilio announced on August 4 a new US East range for Event Streams webhooks (&lt;code&gt;3.80.20.0/25&lt;/code&gt;), scheduled for September 15, 2026. The older range stays active alongside it until Twilio says otherwise.&lt;/li&gt;
&lt;li&gt;SendGrid moved its Event Webhook and Inbound Parse delivery to new IP ranges in a maintenance window that ran from February 23 to March 6, 2026. Its support team says it generally can’t provide stable ranges and points to signature verification.&lt;/li&gt;
&lt;li&gt;A signature proves the provider created this exact payload. An IP list proves only where a packet appeared to come from.&lt;/li&gt;
&lt;li&gt;If you keep an allowlist, generate it from the provider’s API on a schedule, and treat it as a second layer.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What changed in 2026
&lt;/h2&gt;

&lt;h3&gt;
  
  
  GitHub: three new webhook ranges (October 29)
&lt;/h3&gt;

&lt;p&gt;GitHub announced on October 29, 2026 that the Meta API’s &lt;code&gt;hooks&lt;/code&gt; field now includes additional ranges for webhook deliveries on github.com:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;9.234.98.160/28&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;9.234.98.176/28&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;9.234.106.48/28&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you maintain a static allowlist, GitHub says to add these alongside your existing webhook ranges. If you already refresh from the Meta API, nothing needs to change. The ranges apply on all plans, including GitHub Enterprise Cloud.&lt;/p&gt;

&lt;p&gt;This has happened before. On March 29, 2019, GitHub announced that from April 9 it would send webhooks from &lt;code&gt;140.82.112.0/20&lt;/code&gt; in addition to the older &lt;code&gt;192.30.252.0/22&lt;/code&gt;. It noted that the new block had been in the &lt;code&gt;/meta&lt;/code&gt; endpoint since May 2018. The pattern repeats: the API shows the change first, and anyone hardcoding values finds out from failed deliveries.&lt;/p&gt;

&lt;h3&gt;
  
  
  Twilio Event Streams: regional addresses (September 15)
&lt;/h3&gt;

&lt;p&gt;Twilio’s changelog entry, dated August 4, 2026, says that on September 15 it would introduce a new US East (us-east-1) range for Event Streams webhook traffic: &lt;code&gt;3.80.20.0/25&lt;/code&gt; (3.80.20.0 to 3.80.20.127). Twilio describes this as a move from a single shared range to dedicated regional addresses, with other regions to follow.&lt;/p&gt;

&lt;p&gt;The existing range, &lt;code&gt;35.90.102.128/25&lt;/code&gt;, remains active alongside the new one, and Twilio says it will publish a follow-up changelog entry when the legacy range is safe to remove. That range was set by Twilio’s Event Streams GA migration guide, which made it the source of Event Streams webhooks starting October 1, 2023. As of November 27, 2026, I couldn’t find the removal notice, so check Twilio’s changelog before deleting anything. Only customers who validate Event Streams traffic by source IP are affected.&lt;/p&gt;

&lt;p&gt;Twilio’s Static Proxy page, which applies to customers on eligible Twilio Editions, lists both ranges. It says Twilio reserves the right to add or remove addresses and will notify customers at least seven days in advance.&lt;/p&gt;

&lt;h3&gt;
  
  
  SendGrid: two different changes that are easy to confuse
&lt;/h3&gt;

&lt;p&gt;SendGrid has had two separate address changes this year. They point in opposite directions, and summaries often blur them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where webhooks come from (February 23 to March 6).&lt;/strong&gt; SendGrid’s status page describes a maintenance to migrate its Event Webhook and Inbound Parse infrastructure to new IP ranges. For about two weeks, the legacy webhook infrastructure was disabled for 12 hours a day. During those windows, deliveries came only from the new ranges, and customers still allowlisting the old addresses saw delivery failures. SendGrid told them to contact support for the new ranges. It also recommended signature or OAuth verification instead, noting that IP ranges are subject to change and provide limited security. The maintenance was marked completed on March 6, 2026.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where you connect to (August).&lt;/strong&gt; Twilio’s status page lists a “SendGrid Legacy Public IP Deprecation”. It concerns legacy IP addresses used to reach SendGrid via the API and SMTP, so it hit customers who connected to raw IPs instead of domain names such as &lt;code&gt;sendgrid.com&lt;/code&gt; or &lt;code&gt;smtp.sendgrid.net&lt;/code&gt;. The status page listed temporary disablement windows on August 24, 25 and 27 and permanent deprecation on August 31, 2026, and marks the maintenance as completed on September 15. This is traffic &lt;em&gt;to&lt;/em&gt; SendGrid, not the addresses webhooks are sent &lt;em&gt;from&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;For the sending side, SendGrid’s support guidance says it’s generally unable to provide static IP ranges for Event Webhook or Inbound Parse because the services run on dynamic cloud infrastructure. It also says domain allowlisting isn’t supported for webhooks and that reverse DNS shouldn’t be your main defense. Yet during the migration it asked allowlisting customers to get ranges from support. Both facts point the same way: don’t build your security on a list SendGrid doesn’t promise to keep stable.&lt;/p&gt;

&lt;p&gt;A 2021 advisory did list three ranges (&lt;code&gt;167.89.116.0/24&lt;/code&gt;, &lt;code&gt;167.89.117.0/24&lt;/code&gt;, &lt;code&gt;167.89.119.0/24&lt;/code&gt;) for a change scheduled for May 4, 2021, though a later update said the change was postponed. Don’t copy those into a firewall. After the 2026 migration, you can’t assume any list from that era is still right, which is exactly the failure this article is about.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stripe: the better-behaved example
&lt;/h3&gt;

&lt;p&gt;Stripe shows what good IP hygiene from a provider looks like. It publishes its webhook source addresses on its IP addresses page, also as machine-readable &lt;code&gt;ips_webhooks.txt&lt;/code&gt; and &lt;code&gt;ips_webhooks.json&lt;/code&gt; files. It says it gives seven days’ notice of changes through its API announce mailing list. Even so, Stripe tells you to use both IP allowlisting and signature verification.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why IP allowlists drift
&lt;/h2&gt;

&lt;p&gt;Providers send from cloud pools that scale, move between regions and get re-addressed. GitHub’s documentation says it changes its IPs from time to time, doesn’t recommend allowing by IP, and urges regular monitoring of the API if you do. It also says the Meta API list isn’t intended to be exhaustive, so treat it as the best available list rather than a guarantee.&lt;/p&gt;

&lt;p&gt;That produces three failure modes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Additions you never learned about.&lt;/strong&gt; New ranges go live and your firewall rejects them. This is the GitHub, Twilio and SendGrid story above.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Removals you never noticed.&lt;/strong&gt; Dead ranges linger in your list, accepting traffic from addresses the provider may no longer control.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wrong source of truth.&lt;/strong&gt; A blog post or last year’s runbook becomes the “official” list.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The first causes outages. The others cause quiet security debt.&lt;/p&gt;

&lt;p&gt;Missed deliveries are sometimes recoverable. GitHub lets you redeliver webhook deliveries from the past 3 days, through the web interface or the REST API, but doesn’t redeliver failed deliveries automatically. Stripe retries live-mode events for up to three days and lets you resend manually for up to 15 days from the Dashboard or 30 days with the CLI. Don’t count on this for providers whose retry behavior you haven’t checked.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pull GitHub’s ranges from the Meta API
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;GET https://api.github.com/meta&lt;/code&gt; returns GitHub’s service addresses, including the &lt;code&gt;hooks&lt;/code&gt; array of CIDR ranges. It can be called without authentication for public resources, and it returns both IPv4 and IPv6 addresses. GitHub’s REST best practices describe conditional requests: most endpoints return an &lt;code&gt;etag&lt;/code&gt;, which you send back as &lt;code&gt;If-None-Match&lt;/code&gt;, and you get &lt;code&gt;304 Not Modified&lt;/code&gt; if nothing changed. A 304 doesn’t count against your primary rate limit, but only if the request carried an &lt;code&gt;Authorization&lt;/code&gt; header. An hourly refresh is well within limits either way.&lt;/p&gt;

&lt;p&gt;Here is a Node.js (18+) module using only built-ins. I checked the matching logic on Node 22 against the October ranges: addresses inside matched, addresses outside didn’t, and the IPv4-mapped IPv6 form (&lt;code&gt;::ffff:9.234.98.165&lt;/code&gt;) matched too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// github-hooks-allowlist.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;BlockList&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;isIP&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"node:net"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;etag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;allow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;BlockList&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;lastGood&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;refreshGitHubHooks&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"https://api.github.com/meta"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nc"&gt;Accept&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/vnd.github+json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="s2"&gt;"User-Agent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"my-webhook-allowlist"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;etag&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;"If-None-Match"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;etag&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;304&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;lastGood&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`meta fetch failed: ${res.status}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="n"&gt;etag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"etag"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;hooks&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isArray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hooks&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;hooks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"no hooks ranges"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// never swap in an empty list&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;BlockList&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;cidr&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;hooks&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prefix&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cidr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addSubnet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prefix&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;isIP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;addr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"ipv6"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ipv4"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;allow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;lastGood&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hooks&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;hooks&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;isGitHubHookIp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ip&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;allow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;check&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ip&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;isIP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ip&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"ipv6"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"ipv4"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Design choices worth copying:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Refresh at startup and on a schedule&lt;/strong&gt;, hourly or daily. Until the first refresh succeeds, the list is empty and every check fails, so don’t accept traffic before it completes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fail safe.&lt;/strong&gt; On error, keep the last good list and alert. An empty list turns an API hiccup into a total outage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log rejections with the source IP.&lt;/strong&gt; A cluster of rejects from a new range is your earliest warning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alert on diffs.&lt;/strong&gt; A changed &lt;code&gt;hooks&lt;/code&gt; array is the October 29 announcement, delivered automatically.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the allowlist lives in a cloud firewall or WAF, run the same refresh as a scheduled job that updates the rule.&lt;/p&gt;

&lt;h2&gt;
  
  
  Signature checks beat IP lists
&lt;/h2&gt;

&lt;p&gt;An IP list asks whether a packet appeared to come from a provider address. A signature asks whether the provider created this exact payload with a secret only you share. Signatures don’t drift when a region is added, and they cover the content. Providers recommend them: GitHub’s best practices say to use a webhook secret, and SendGrid’s support guidance says to verify signatures rather than rely on IPs.&lt;/p&gt;

&lt;h3&gt;
  
  
  GitHub
&lt;/h3&gt;

&lt;p&gt;With a secret configured, GitHub sends &lt;code&gt;X-Hub-Signature-256&lt;/code&gt;, formatted as &lt;code&gt;sha256=&lt;/code&gt; plus an HMAC hex digest of the payload. The header is absent if you set no secret. The older &lt;code&gt;X-Hub-Signature&lt;/code&gt; uses SHA-1 and is included only for legacy reasons.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;crypto&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"node:crypto"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;verifyGitHub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rawBody&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;expected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="s2"&gt;"sha256="&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createHmac&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"sha256"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rawBody&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"hex"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;header&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timingSafeEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hash the &lt;strong&gt;raw body bytes&lt;/strong&gt;, compare in &lt;strong&gt;constant time&lt;/strong&gt;, and make sure no proxy or load balancer alters the payload or headers. GitHub publishes a test vector: secret &lt;code&gt;It's a Secret to Everybody&lt;/code&gt;, payload &lt;code&gt;Hello, World!&lt;/code&gt;, signature &lt;code&gt;757107ea0eb2509fc211221cce984b8a37570b6d7586c22c46f4379c8b043e17&lt;/code&gt;. The function above returns &lt;code&gt;true&lt;/code&gt; for it and &lt;code&gt;false&lt;/code&gt; for a wrong signature.&lt;/p&gt;

&lt;h3&gt;
  
  
  Twilio
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;X-Twilio-Signature&lt;/code&gt; is a base64 HMAC-SHA1, keyed with your primary Auth Token. It covers the &lt;strong&gt;full request URL&lt;/strong&gt; (scheme, port and query string) followed by each POST parameter’s name and value, sorted alphabetically by name, with no delimiters. Because the URL is signed, anything that changes what your app thinks the URL is will break validation. That includes a TLS-terminating proxy, a rewritten host, or a trailing slash added by a web server.&lt;/p&gt;

&lt;p&gt;Twilio’s notes add a few details that matter behind a tunnel:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For JSON bodies, Twilio adds a &lt;code&gt;bodySHA256&lt;/code&gt; query parameter, and you validate with the body-aware helper (&lt;code&gt;validateRequestWithBody&lt;/code&gt; in the Node SDK).&lt;/li&gt;
&lt;li&gt;Port handling differs by product. For SMS callbacks, Twilio keeps the port in the URL it signs; for voice callbacks over HTTPS, it drops it.&lt;/li&gt;
&lt;li&gt;Twilio recommends using the SDK validators rather than your own implementation, and passing them the exact public URL you configured.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  SendGrid
&lt;/h3&gt;

&lt;p&gt;The Signed Event Webhook uses ECDSA. Each POST carries &lt;code&gt;X-Twilio-Email-Event-Webhook-Signature&lt;/code&gt; and &lt;code&gt;X-Twilio-Email-Event-Webhook-Timestamp&lt;/code&gt;. The signed value is a SHA-256 hash of the timestamp followed by the payload, using the raw bytes. SendGrid warns that converting raw bytes to a JSON string can alter characters that were part of the signature. You enable signing per webhook in Mail Settings under Event Webhooks, and the key pair is generated when you save. Use the public key shown there, and prefer SendGrid’s official Event Webhook helpers over hand-rolled verification. SendGrid also offers OAuth 2.0 as a separate, independent control; the two can be used together.&lt;/p&gt;

&lt;h3&gt;
  
  
  What signatures don’t solve
&lt;/h3&gt;

&lt;p&gt;A valid signature doesn’t stop replay by itself. GitHub suggests using &lt;code&gt;X-GitHub-Delivery&lt;/code&gt; to ensure each delivery is processed once (a redelivery reuses the original ID). Stripe signs a timestamp into its header, and its libraries reject events more than 5 minutes off by default; Stripe warns against setting the tolerance to 0, which disables the check. For SendGrid, the signed timestamp lets you apply your own window. The documentation I read doesn’t prescribe one, so pick one and keep your server clock synced.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one paragraph on X-Forwarded-For
&lt;/h2&gt;

&lt;p&gt;Behind a proxy or tunnel, the TCP peer your app sees is the proxy, not GitHub, so an IP check must read the client address from a forwarded header. That header is trustworthy only when set by infrastructure you control. A request carrying a forged &lt;code&gt;X-Forwarded-For&lt;/code&gt; with a GitHub address must never pass. Set your framework’s trusted-proxy option to the exact hop, and see the Forwarded Headers post in this series for the full treatment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test the allowlist path through a tunnel
&lt;/h2&gt;

&lt;p&gt;Stale allowlists survive because nobody exercises them until production. A tunnel gives you a public HTTPS URL pointing at your laptop, so the real provider, the real proxy hop and your real rules run together. A stable subdomain lets you register the callback once.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Run the app&lt;/strong&gt; with the allowlist and signature check on, tunnel attached.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Register the tunnel URL&lt;/strong&gt; as a webhook on a throwaway GitHub repo, with a secret. Trigger an event, or redeliver one from the last 3 days. Confirm a &lt;code&gt;2xx&lt;/code&gt; and a verified signature.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log both the socket peer and the forwarded IP.&lt;/strong&gt; If your check uses the wrong one, everything is rejected (the peer is the tunnel agent) or everything passes (you trusted a spoofable header).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Send a spoofed request.&lt;/strong&gt; &lt;code&gt;curl&lt;/code&gt; the tunnel URL with a forged &lt;code&gt;X-Forwarded-For&lt;/code&gt; in a GitHub range and a bogus signature. It must be rejected on the signature, whatever the IP check does. That proves the signature, not the list, is the real gate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simulate drift.&lt;/strong&gt; Drop one new &lt;code&gt;/28&lt;/code&gt; from your test list, redeliver, and confirm the rejection is logged with the IP and fires your alert. Then restore it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Break the proxy on purpose.&lt;/strong&gt; For Twilio, change the scheme or host your app reconstructs and watch validation fail, safely.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If your tunnel offers a request log, compare headers as sent with headers as received to find modified bodies or dropped headers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Local forwarders are not the same test
&lt;/h3&gt;

&lt;p&gt;GitHub’s CLI extension (&lt;code&gt;gh webhook forward&lt;/code&gt;) and Stripe’s &lt;code&gt;stripe listen&lt;/code&gt; both forward events to a local endpoint without a public URL. They’re handy for handler logic. GitHub says webhook forwarding works only for repository and organization webhooks, is meant for testing and development, and allows one person at a time per repository or organization. The pages I read don’t say that forwarded events pass through your firewall rules, so use a tunnel when you want to exercise the allowlist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Maintenance checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Make signature verification the primary control wherever offered.&lt;/li&gt;
&lt;li&gt;Generate any IP allowlist from the provider’s API or published list, never a pasted one.&lt;/li&gt;
&lt;li&gt;Refresh on a schedule, keep the last good copy, alert on diffs.&lt;/li&gt;
&lt;li&gt;Subscribe to the GitHub and Twilio changelogs, SendGrid’s status page, and Stripe’s API announce list.&lt;/li&gt;
&lt;li&gt;For Twilio Event Streams, keep both ranges until Twilio retires the legacy one.&lt;/li&gt;
&lt;li&gt;Deduplicate on delivery IDs and check signed timestamps.&lt;/li&gt;
&lt;li&gt;Re-run the tunnel test after firewall, proxy or framework upgrades.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Does GitHub recommend IP allowlisting for webhooks?
&lt;/h3&gt;

&lt;p&gt;Mixed signals, so read both pages. Its webhook best practices describe an allowlist as a way to block spoofed requests and tell you to update it periodically. Its IP documentation says it doesn’t recommend allowing by IP and urges regular monitoring of the API if you do. For verifying origin and integrity, it tells you to validate the signature.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where are GitHub’s current webhook IP ranges?
&lt;/h3&gt;

&lt;p&gt;In the &lt;code&gt;hooks&lt;/code&gt; array returned by &lt;code&gt;GET https://api.github.com/meta&lt;/code&gt;. Query the API; don’t copy documentation examples.&lt;/p&gt;

&lt;h3&gt;
  
  
  How fast must my endpoint respond to GitHub?
&lt;/h3&gt;

&lt;p&gt;With a &lt;code&gt;2xx&lt;/code&gt; within 10 seconds, or GitHub terminates the connection and counts the delivery as failed. Acknowledge quickly and process asynchronously.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I need to change anything for Twilio’s new range?
&lt;/h3&gt;

&lt;p&gt;Only if you validate Event Streams traffic by source IP. Add &lt;code&gt;3.80.20.0/25&lt;/code&gt; and keep &lt;code&gt;35.90.102.128/25&lt;/code&gt; until Twilio says otherwise.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I allowlist SendGrid’s webhook IPs?
&lt;/h3&gt;

&lt;p&gt;SendGrid generally can’t provide stable ranges, and it changed its webhook ranges in early 2026. Use the Signed Event Webhook, optionally with OAuth 2.0.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I recover deliveries I missed while my allowlist was stale?
&lt;/h3&gt;

&lt;p&gt;GitHub allows redelivery of deliveries from the past 3 days and doesn’t redeliver automatically. Stripe retries automatically for up to three days in live mode and allows manual resends for longer. Check each provider’s retry and replay window before you rely on it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Provider IP ranges are configuration owned by someone else. GitHub added webhook ranges in October, Twilio is moving Event Streams to regional addresses, and SendGrid migrated its webhook infrastructure in February and March and says not to rely on IPs. Verify signatures on the raw body, deduplicate deliveries, and treat any network allowlist as a self-refreshing defense in depth. Then prove it through a tunnel before a missed delivery proves it doesn’t.&lt;/p&gt;

&lt;p&gt;One adjacent note: on November 17, GitHub put Event Streams into preview (waitlist required), where a client keeps a connection open to receive pull request events and no public webhook endpoint is required. It doesn’t replace ordinary webhooks, but for agents waiting on PR activity it removes the inbound endpoint, and the allowlist question, entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.blog/changelog/2026-10-29-webhook-ip-ranges-added-to-the-meta-api/" rel="noopener noreferrer"&gt;GitHub Changelog: Webhook IP ranges added to the Meta API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.blog/changelog/2026-11-17-github-event-streams-is-now-in-preview/" rel="noopener noreferrer"&gt;GitHub Changelog: GitHub Event Streams is now in preview&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-githubs-ip-addresses" rel="noopener noreferrer"&gt;GitHub Docs: About GitHub’s IP addresses&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/webhooks/using-webhooks/best-practices-for-using-webhooks" rel="noopener noreferrer"&gt;GitHub Docs: Best practices for using webhooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/webhooks/using-webhooks/validating-webhook-deliveries" rel="noopener noreferrer"&gt;GitHub Docs: Validating webhook deliveries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/webhooks/testing-and-troubleshooting-webhooks/redelivering-webhooks" rel="noopener noreferrer"&gt;GitHub Docs: Redelivering webhooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/webhooks/testing-and-troubleshooting-webhooks/using-the-github-cli-to-forward-webhooks-for-testing" rel="noopener noreferrer"&gt;GitHub Docs: Using the GitHub CLI to forward webhooks for testing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/rest/meta/meta" rel="noopener noreferrer"&gt;GitHub Docs: REST API endpoints for meta data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/rest/using-the-rest-api/best-practices-for-using-the-rest-api" rel="noopener noreferrer"&gt;GitHub Docs: Best practices for using the REST API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.github.com/changes/2019-03-29-webhooks-ip-changes" rel="noopener noreferrer"&gt;GitHub Developer: Webhook IP addresses are changing (2019)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.twilio.com/en-us/changelog/ip-addres-event-streams-webhooks-us-east" rel="noopener noreferrer"&gt;Twilio Changelog: New Regional IP Address for Event Streams Webhooks in US East&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twilio.com/docs/events/ga-migration" rel="noopener noreferrer"&gt;Twilio Docs: Event Streams GA migration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.twilio.com/docs/iam/twilio-editions/twilio-static-proxy" rel="noopener noreferrer"&gt;Twilio Docs: Static Proxy for Webhooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twilio.com/docs/usage/security" rel="noopener noreferrer"&gt;Twilio Docs: Security (validating requests)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://status.twilio.com/incidents/rn6jhbzx6db0" rel="noopener noreferrer"&gt;Twilio Status: SendGrid Legacy Public IP Deprecation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://status.sendgrid.com/incidents/lkzxs32z10d4" rel="noopener noreferrer"&gt;SendGrid Status: Event Webhook and Inbound Parse Maintenance, February 23 to March 6, 2026&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://support.sendgrid.com/hc/en-us/articles/44375457225371-How-to-Configure-Firewall-Settings-for-SendGrid-Webhook-and-Inbound-Parse-IPs" rel="noopener noreferrer"&gt;SendGrid Support: Firewall settings for Webhook and Inbound Parse IPs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.twilio.com/docs/sendgrid/for-developers/tracking-events/getting-started-event-webhook-security-features" rel="noopener noreferrer"&gt;SendGrid Docs: Event Webhook security features&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://status.sendgrid.com/incidents/k8mtn43gv73z" rel="noopener noreferrer"&gt;SendGrid Status: Event Webhook outbound IP change (2021)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.stripe.com/ips" rel="noopener noreferrer"&gt;Stripe Docs: Domains and IP addresses&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.stripe.com/webhooks/signatures?lang=node" rel="noopener noreferrer"&gt;Stripe Docs: Receive Stripe events in your webhook endpoint&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://instatunnel.my/blog/the-webhook-allowlist-that-went-stale-provider-ip-ranges-change-under-you" rel="noopener noreferrer"&gt;https://instatunnel.my/blog/the-webhook-allowlist-that-went-stale-provider-ip-ranges-change-under-you&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
    </item>
    <item>
      <title>Your Deep Link Opens Safari, Not Your App: Testing Universal Links and Android App Links Through a Tunnel</title>
      <dc:creator>InstaTunnel</dc:creator>
      <pubDate>Thu, 26 Nov 2026 01:40:52 +0000</pubDate>
      <link>https://dev.to/instatunnel/your-deep-link-opens-safari-not-your-app-testing-universal-links-and-android-app-links-through-a-img</link>
      <guid>https://dev.to/instatunnel/your-deep-link-opens-safari-not-your-app-testing-universal-links-and-android-app-links-through-a-img</guid>
      <description>&lt;p&gt;You tap a link in Notes or a chat app and expect your app to open on the product screen. Instead, Safari loads your website, or Android shows a chooser dialog. The code is fine and the route handler is fine, yet the link still ends up in the browser.&lt;/p&gt;

&lt;p&gt;This is one of the most frustrating bugs in mobile development because the failure happens &lt;em&gt;before&lt;/em&gt; your code runs. The operating system decides whether your app owns that URL, and it makes that decision using files hosted on a domain you control.&lt;/p&gt;

&lt;p&gt;During local development, that domain is usually a tunnel pointing at &lt;code&gt;localhost&lt;/code&gt;. Tunnels change the rules in ways most guides never mention. This article covers how iOS Universal Links and Android App Links verify a domain, why a tunnel complicates that, and how to build a test setup that survives restarts. Details were checked against Apple, Android, ngrok and Cloudflare documentation as of &lt;strong&gt;November 26, 2026&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a Deep Link Opens the Browser Instead of Your App
&lt;/h2&gt;

&lt;p&gt;A custom URL scheme such as &lt;code&gt;myapp://&lt;/code&gt; is only a registration. Any app can claim it, and the OS has no way to confirm the app actually owns it.&lt;/p&gt;

&lt;p&gt;Universal Links (iOS) and App Links (Android) work differently. They use normal &lt;code&gt;https://&lt;/code&gt; URLs, and the OS hands them to your app only if your website &lt;em&gt;proves&lt;/em&gt; it approves that app. If the proof fails, nothing errors out visibly. The link opens in the browser (or, on Android, in a chooser), and you get the symptom in this article’s title.&lt;/p&gt;

&lt;p&gt;So the debugging question is never “is my navigation code wrong?” It is “did the OS verify my domain?” On both platforms, verification depends on a JSON file served from a &lt;code&gt;/.well-known/&lt;/code&gt; path, plus a matching declaration inside the app.&lt;/p&gt;

&lt;h2&gt;
  
  
  How iOS Verifies Universal Links
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The apple-app-site-association file
&lt;/h3&gt;

&lt;p&gt;Apple’s documentation describes a file named &lt;code&gt;apple-app-site-association&lt;/code&gt; (no extension) hosted at &lt;code&gt;https://&amp;lt;fully qualified domain&amp;gt;/.well-known/apple-app-site-association&lt;/code&gt;. You must host it over &lt;code&gt;https://&lt;/code&gt; with a valid certificate and with no redirects. Serving it as valid JSON with &lt;code&gt;Content-Type: application/json&lt;/code&gt; is the safe choice.&lt;/p&gt;

&lt;p&gt;A minimal file in the current recommended format looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"applinks"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"details"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"appIDs"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"ABCDE12345.com.example.app"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"components"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"/buy/*"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"/help/website/*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"exclude"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The app ID is your Application Identifier Prefix (Team ID) plus your bundle identifier. Apple’s debugging technote (TN3155) also accepts a legacy format with &lt;code&gt;appID&lt;/code&gt; (a string) and &lt;code&gt;paths&lt;/code&gt; (an array), but it advises against mixing the two formats because that may cause unexpected behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  The entitlement
&lt;/h3&gt;

&lt;p&gt;Your app needs the Associated Domains capability with an entry like &lt;code&gt;applinks:links.example.com&lt;/code&gt;. If your site uses several subdomains, each one needs its own entitlement entry and must serve its own association file.&lt;/p&gt;

&lt;p&gt;The technote adds a wildcard rule. A file hosted at the root domain (&lt;code&gt;https://example.com/.well-known/...&lt;/code&gt;) covers &lt;code&gt;applinks:example.com&lt;/code&gt; and the wildcard &lt;code&gt;applinks:*.example.com&lt;/code&gt;, but not specific subdomains such as &lt;code&gt;applinks:www.example.com&lt;/code&gt;. Those need their own file at their own host.&lt;/p&gt;

&lt;p&gt;Domains in &lt;code&gt;applinks&lt;/code&gt; cannot contain a port number. &lt;code&gt;applinks:example.com:8080&lt;/code&gt; will not open your app, which matters for any tunnel that exposes a non-standard port.&lt;/p&gt;

&lt;h3&gt;
  
  
  The part that surprises everyone: Apple’s CDN
&lt;/h3&gt;

&lt;p&gt;Starting with iOS 14 and macOS 11, apps no longer request the association file directly from your server. They request it from an Apple-managed content delivery network built for associated domains. If the CDN has an old copy, or no copy, it connects to your web server to fetch the latest.&lt;/p&gt;

&lt;p&gt;According to Apple, the CDN requests your file within 24 hours of the app being installed. Devices then check for updates roughly once a week. There is no direct CDN invalidation option; to pull a newer copy, reinstall the app.&lt;/p&gt;

&lt;p&gt;Two consequences follow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Your server must be reachable from any IP address, must not redirect, and must not block the CDN. Apple’s technote says the server should also accept all user agents, and suggests testing with a made-up one: &lt;code&gt;curl -A "MyAgent-Bot/*" https://example.com/.well-known/apple-app-site-association&lt;/code&gt;. A 403 or 404 usually means your site denied access.&lt;/li&gt;
&lt;li&gt;You can see what Apple’s CDN has cached by requesting &lt;code&gt;https://app-site-association.cdn-apple.com/a/v1/&amp;lt;your-domain&amp;gt;&lt;/code&gt;. This URL is widely used for the check but is not described in Apple’s own documentation. If it shows stale or missing content, devices that rely on the CDN will see the same.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Developer-Mode Shortcut: &lt;code&gt;?mode=developer&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;For development, Apple provides an alternate mode that bypasses the CDN. You append a query string to the entitlement value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;applinks:links.example.com?mode=developer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Apple’s entitlement documentation says &lt;code&gt;developer&lt;/code&gt; mode limits access to devices that are in developer mode. In this mode you can use any valid SSL certificate on your web server, including one the system does not trust. Apple recommends it for servers unreachable from the public internet and for testing association-file changes faster than the CDN can pick them up. It also warns you not to expose users to security risks such as machine-in-the-middle attacks.&lt;/p&gt;

&lt;p&gt;Several details trip people up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Turn on the device switch.&lt;/strong&gt; Enable Developer Mode on the device, then go to Settings &amp;gt; Developer, scroll to the Universal Links section, and turn on &lt;strong&gt;Associated Domains Development&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It is for development builds only.&lt;/strong&gt; Apple states that only apps signed with a development profile can use developer mode, and users must opt in on each device. TestFlight and App Store builds are not development-signed, so remove &lt;code&gt;?mode=developer&lt;/code&gt; before you ship them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It changes your tunnel needs.&lt;/strong&gt; Because developer mode connects directly to your server and tolerates untrusted certificates, an iOS-only test can run against a private server on your network without a public tunnel. Android still needs a publicly reachable HTTPS host with a valid &lt;code&gt;assetlinks.json&lt;/code&gt;, so a tunnel remains the practical option for cross-platform testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How Android Verifies App Links
&lt;/h2&gt;

&lt;p&gt;Android’s flow is more direct. If at least one intent filter has &lt;code&gt;android:autoVerify="true"&lt;/code&gt;, installing the app on Android 6.0 (API level 23) or higher triggers automatic verification of the hosts in your intent filters. The system looks at filters that include the &lt;code&gt;VIEW&lt;/code&gt; action, the &lt;code&gt;BROWSABLE&lt;/code&gt; and &lt;code&gt;DEFAULT&lt;/code&gt; categories, and an &lt;code&gt;http&lt;/code&gt; or &lt;code&gt;https&lt;/code&gt; scheme. For each unique hostname, Android requests &lt;code&gt;https://&amp;lt;hostname&amp;gt;/.well-known/assetlinks.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A valid file looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"relation"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"delegate_permission/common.handle_all_urls"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"target"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"namespace"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"android_app"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"package_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"com.example.app"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"sha256_cert_fingerprints"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"14:6D:E9:...:E5"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Google’s hosting requirements are strict:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Content type &lt;code&gt;application/json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;HTTPS, regardless of whether your intent filters declare &lt;code&gt;http&lt;/code&gt; or &lt;code&gt;https&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No redirects&lt;/strong&gt; (no 301 or 302).&lt;/li&gt;
&lt;li&gt;A file on every host your app supports. If your links cover multiple hosts, publish &lt;code&gt;assetlinks.json&lt;/code&gt; on each one.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The signing-certificate trap
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;sha256_cert_fingerprints&lt;/code&gt; field accepts multiple fingerprints, which you can use to cover debug and production builds. If you use Play App Signing, the fingerprint produced by running &lt;code&gt;keytool&lt;/code&gt; locally will usually not match the one on users’ devices. Google points you to the correct snippet in Play Console under Release &amp;gt; Setup &amp;gt; App signing. A debug build installed over USB is signed with your debug key, so that fingerprint needs to be listed too, or verification fails.&lt;/p&gt;

&lt;h3&gt;
  
  
  Android-specific behavior worth knowing
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;On Android 11 (API level 30) and lower, the system makes your app the default handler only if it finds a matching file for &lt;strong&gt;all&lt;/strong&gt; hosts in the manifest. One broken host can sink the whole filter.&lt;/li&gt;
&lt;li&gt;On Android 12 and higher, you can trigger verification manually.&lt;/li&gt;
&lt;li&gt;Only one app at a time can be associated with a given domain on a device. If another app already holds it, the user must disassociate that app before yours can take over.&lt;/li&gt;
&lt;li&gt;Android 15 (API 35) and higher periodically re-verify domains in the background. Edits to &lt;code&gt;assetlinks.json&lt;/code&gt; can take up to seven days to reach all devices. On Android 14 and lower there is no periodic re-verification, and updates are typically picked up only when the app is installed or updated.&lt;/li&gt;
&lt;li&gt;On Android 15 and higher with Google services, &lt;code&gt;assetlinks.json&lt;/code&gt; can also carry “dynamic” path, query and fragment rules (&lt;code&gt;dynamic_app_link_components&lt;/code&gt;). They are evaluated in order, and they can only narrow what your manifest’s intent filters already declare. Google recommends broad manifest filters (scheme and host) plus server-side rules for path-level routing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Tunnels Make This Harder
&lt;/h2&gt;

&lt;p&gt;A tunnel gives your laptop a public HTTPS address, which is exactly what both verifiers need. The trouble is how that address behaves over time.&lt;/p&gt;

&lt;h3&gt;
  
  
  The random-URL problem
&lt;/h3&gt;

&lt;p&gt;Many tunnel tools give you a different hostname on each run. Cloudflare’s documentation says a quick tunnel (&lt;code&gt;cloudflared tunnel --url http://localhost:8080&lt;/code&gt;) gets a random &lt;code&gt;trycloudflare.com&lt;/code&gt; address. It exists only while &lt;code&gt;cloudflared&lt;/code&gt; runs, and the next run mints a different one.&lt;/p&gt;

&lt;p&gt;Now connect that to what you just learned. On iOS, the host is baked into the &lt;strong&gt;entitlement&lt;/strong&gt;, which is part of the signed build. On Android, it lives in the &lt;strong&gt;manifest intent filter&lt;/strong&gt;. A new hostname therefore means:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Edit the entitlement and manifest.&lt;/li&gt;
&lt;li&gt;Rebuild and reinstall the app.&lt;/li&gt;
&lt;li&gt;Wait for verification (Android) or CDN pickup (iOS without developer mode).&lt;/li&gt;
&lt;li&gt;Repeat after every tunnel restart.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That loop turns a ten-second check into a ten-minute chore, and it hides real bugs behind setup noise.&lt;/p&gt;

&lt;h3&gt;
  
  
  The stable-hostname fix
&lt;/h3&gt;

&lt;p&gt;The better approach is to register one host, once. The options as of this writing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;ngrok:&lt;/strong&gt; Every account, including free ones, gets one assigned dev domain that stays the same across agent restarts. You cannot choose or rename it on the free plan. ngrok’s announcement uses &lt;code&gt;ngrok-free.dev&lt;/code&gt; as the example base domain, while its current docs show &lt;code&gt;ngrok-free.app&lt;/code&gt;, so check Gateway &amp;gt; Domains in your dashboard for yours. Picking a custom ngrok domain such as &lt;code&gt;your-company.ngrok.app&lt;/code&gt; requires a paid plan (the Hobbyist plan, per ngrok), and bringing your own domain is also a paid feature. Free-plan limits include 20k HTTP requests per month, 1 GB of bandwidth per month, and 3 concurrent endpoints.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloudflare Tunnel:&lt;/strong&gt; A &lt;em&gt;named&lt;/em&gt; tunnel keeps its identity as a record in your Cloudflare account, so stopping &lt;code&gt;cloudflared&lt;/code&gt; leaves it in place. It can serve a stable hostname on a zone you control, such as &lt;code&gt;dev.example.com&lt;/code&gt;. It requires a Cloudflare account and a domain on Cloudflare. Quick tunnels, by contrast, are meant for testing and carry no uptime guarantee. They return a &lt;code&gt;429&lt;/code&gt; when they hit their request limit, and they do not support Server-Sent Events.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With a stable hostname, the entitlement and manifest are written once. Restarting the tunnel changes nothing the OS cares about, and your association files keep resolving at the same address.&lt;/p&gt;

&lt;h3&gt;
  
  
  The ngrok interstitial
&lt;/h3&gt;

&lt;p&gt;On the free tier, ngrok injects a warning page in front of HTML browser traffic. After a visitor clicks through, a cookie suppresses it for 7 days on that domain. ngrok says this does not affect API or programmatic access, and that a paid plan removes it. The documented client-side workaround is to send an &lt;code&gt;ngrok-skip-browser-warning&lt;/code&gt; header, but you cannot control the headers that Apple’s CDN or Android’s verifier send.&lt;/p&gt;

&lt;p&gt;So do not assume the interstitial stays out of the way. Request your files with &lt;code&gt;curl&lt;/code&gt; and, for iOS, check the CDN URL. If either returns an HTML page instead of JSON, verification will fail.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Practical Testing Workflow
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Serve both files through the tunnel
&lt;/h3&gt;

&lt;p&gt;Make your local server return the correct content for both paths with no redirects. That includes redirects done by a proxy, such as &lt;code&gt;http&lt;/code&gt; to &lt;code&gt;https&lt;/code&gt; or apex to &lt;code&gt;www&lt;/code&gt;. Both files should be valid JSON, and Android specifically requires &lt;code&gt;application/json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Check them from outside your network:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -i https://dev.example.com/.well-known/apple-app-site-association
curl -i https://dev.example.com/.well-known/assetlinks.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You want &lt;code&gt;200&lt;/code&gt;, JSON bodies, and no &lt;code&gt;301&lt;/code&gt; or &lt;code&gt;302&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Use a build variant for the tunnel host
&lt;/h3&gt;

&lt;p&gt;Do not hard-code the tunnel host in production configuration. Google specifically warns against publishing an app with test URLs in the manifest that may not be publicly accessible (for example, ones reachable only over a VPN). Its workaround is to configure build variants so dev builds generate a different manifest. In practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Android:&lt;/strong&gt; use a manifest placeholder for the host in a debug variant.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;iOS:&lt;/strong&gt; use a separate debug entitlements file that includes &lt;code&gt;applinks:dev.example.com?mode=developer&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 3: Test iOS correctly
&lt;/h3&gt;

&lt;p&gt;Apple’s technote is clear about how &lt;em&gt;not&lt;/em&gt; to test: typing the URL into a browser’s address bar never opens the app, because that is direct navigation within the browser. Instead:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Paste the link into &lt;strong&gt;Notes&lt;/strong&gt; and long-press it. If everything is configured correctly, you will see options to open in your app and in the browser. Your choice becomes the default for that domain, so repeat the steps to change it.&lt;/li&gt;
&lt;li&gt;Or turn on Developer Mode, then go to &lt;strong&gt;Settings &amp;gt; Developer &amp;gt; Associated Domains Development &amp;gt; Diagnostics&lt;/strong&gt;, type the full URL, and read the result.&lt;/li&gt;
&lt;li&gt;Remember that a link whose domain matches the page you are already browsing stays in the browser. Apple’s workaround is to use a different subdomain for links that should launch the app.&lt;/li&gt;
&lt;li&gt;On a Mac, run &lt;code&gt;sudo swcutil dl -d &amp;lt;domain&amp;gt;&lt;/code&gt; to confirm the file downloads. Run &lt;code&gt;sudo swcutil verify -d &amp;lt;domain&amp;gt; -j &amp;lt;file.json&amp;gt; -u &amp;lt;url&amp;gt;&lt;/code&gt; to test your URL pattern against a local copy. Excluded paths report a “blocked match.”&lt;/li&gt;
&lt;li&gt;If it still fails, take a sysdiagnose and open &lt;code&gt;swcutil_show.txt&lt;/code&gt;. Search for your App ID. A &lt;code&gt;Site/Fmwk Approval&lt;/code&gt; value of &lt;code&gt;approved&lt;/code&gt; means Apple’s CDN approved your domain. &lt;code&gt;unspecified&lt;/code&gt; or &lt;code&gt;denied&lt;/code&gt; points to access problems or a domain missing from your entitlement.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Also note that web browsers, and apps registered as browsers, are not allowed to register universal links through &lt;code&gt;applinks&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Test Android correctly
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Validate the file with the Digital Asset Links API: &lt;code&gt;https://digitalassetlinks.googleapis.com/v1/statements:list?source.web.site=https://dev.example.com&amp;amp;relation=delegate_permission/common.handle_all_urls&lt;/code&gt;. Google’s Statement List Generator and Tester is another option.&lt;/li&gt;
&lt;li&gt;Install the app and wait at least 20 seconds for the asynchronous verification to finish.&lt;/li&gt;
&lt;li&gt;Check the state:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb shell pm get-app-links com.example.app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A host showing &lt;code&gt;verified&lt;/code&gt; passed. &lt;code&gt;none&lt;/code&gt; means nothing is recorded yet, so the verifier may not be finished. &lt;code&gt;legacy_failure&lt;/code&gt; or an error code of 1024 or higher means verification failed. Other states (&lt;code&gt;approved&lt;/code&gt;, &lt;code&gt;denied&lt;/code&gt;, &lt;code&gt;migrated&lt;/code&gt;, &lt;code&gt;restored&lt;/code&gt;, &lt;code&gt;system_configured&lt;/code&gt;) mean the result was forced, migrated or set by the device.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;To rerun verification on Android 12 or later (apps targeting an older SDK first need &lt;code&gt;adb shell am compat enable 175408749 com.example.app&lt;/code&gt;):
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb shell pm set-app-links --package com.example.app 0 all
adb shell pm verify-app-links --re-verify com.example.app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Wait a few minutes before reviewing the results.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Test an actual tap:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;adb shell am start -a android.intent.action.VIEW \
  -c android.intent.category.BROWSABLE \
  -d &lt;span class="s2"&gt;"https://dev.example.com/product/42"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Starting in Android 17, &lt;code&gt;adb shell am start --debug-link -a android.intent.action.VIEW -d "&amp;lt;url&amp;gt;"&lt;/code&gt; prints an “App Link Resolution Debug” report. It lists every candidate app that matched, which manifest attributes matched, the verification state, and any Dynamic App Links rules that were evaluated. That makes ambiguous chooser dialogs much easier to diagnose.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Keep in mind that user preferences take precedence over verification. A link that “works” on your test phone might only mean you once enabled the app to open supported links manually. &lt;code&gt;adb shell pm get-app-links --user cur com.example.app&lt;/code&gt; shows the per-user selection state.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting Checklist
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Likely cause&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;iOS opens Safari every time&lt;/td&gt;
&lt;td&gt;File not cached by the CDN, a redirect or 403/404 on the file, wrong Team ID or bundle ID in &lt;code&gt;appIDs&lt;/code&gt;, or an &lt;code&gt;applinks&lt;/code&gt; domain that doesn’t match the file’s host&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Works in developer mode, fails on TestFlight&lt;/td&gt;
&lt;td&gt;Production builds use the CDN and can’t use &lt;code&gt;?mode=developer&lt;/code&gt;; the file must be public, unredirected and cached&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Link from a page on the same domain stays in the browser&lt;/td&gt;
&lt;td&gt;Browsers treat same-domain navigation as in-browser; link from a different subdomain&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;iOS never picks up a new file&lt;/td&gt;
&lt;td&gt;CDN cache plus roughly weekly refresh; reinstall the app, or use developer mode while iterating&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Android shows a chooser dialog&lt;/td&gt;
&lt;td&gt;Verification failed, wrong fingerprint, or another app already holds the domain&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Works for &lt;code&gt;example.com&lt;/code&gt; but not &lt;code&gt;www.example.com&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Each host needs its own entitlement or intent filter and its own file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Link fails after the tunnel restarts&lt;/td&gt;
&lt;td&gt;Random hostname; move to a static or named tunnel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;iOS &lt;code&gt;applinks:www.example.com&lt;/code&gt; fails with the file only at the root&lt;/td&gt;
&lt;td&gt;A root-domain file covers the root and &lt;code&gt;*.example.com&lt;/code&gt;, not specific subdomains&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HTML or a warning page where JSON should be&lt;/td&gt;
&lt;td&gt;Tunnel interstitial or proxy rewriting the response; check with &lt;code&gt;curl&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A link opening in the browser almost always means domain verification failed, not that your routing code is broken.&lt;/li&gt;
&lt;li&gt;iOS gets the association file from Apple’s CDN, not from your server. &lt;code&gt;?mode=developer&lt;/code&gt; on the entitlement bypasses the CDN for devices in developer mode, but it only works in development-signed builds and must not ship.&lt;/li&gt;
&lt;li&gt;Android verifies &lt;code&gt;assetlinks.json&lt;/code&gt; directly, requires correct signing fingerprints, and gives you &lt;code&gt;adb&lt;/code&gt; commands to retrigger and inspect verification.&lt;/li&gt;
&lt;li&gt;Random tunnel URLs force an entitlement change, a manifest change and a rebuild after every restart. A stable hostname is registered once.&lt;/li&gt;
&lt;li&gt;Test with Notes, the Diagnostics screen, &lt;code&gt;swcutil&lt;/code&gt; and &lt;code&gt;adb&lt;/code&gt;, not by typing URLs into a browser.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Why does my Universal Link open Safari instead of my app?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Most often the association file is unreachable, redirected, blocked, or not yet cached by Apple’s CDN, or the app’s entitlement does not match the domain serving the file. Testing by typing the URL into Safari also never opens the app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do I need to change the entitlement every time my tunnel URL changes?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Yes, if the tunnel hostname changes, because the host is part of the entitlement (iOS) and the manifest (Android). Use a stable hostname to avoid this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What does &lt;code&gt;?mode=developer&lt;/code&gt; do?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
It makes a device in developer mode fetch the association file directly from your server instead of Apple’s CDN, and it accepts any valid SSL certificate, even one the system doesn’t trust.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I use &lt;code&gt;?mode=developer&lt;/code&gt; in production?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
No. Apple says only apps signed with a development profile can use it, so remove it for TestFlight and App Store builds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long does Android App Links verification take?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Wait at least 20 seconds after install for the asynchronous check, then query with &lt;code&gt;adb shell pm get-app-links&lt;/code&gt;. File changes can take up to seven days to propagate on Android 15 and higher.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I include a port number in &lt;code&gt;applinks&lt;/code&gt;?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
No. Apple’s technote states that domains in &lt;code&gt;applinks&lt;/code&gt; cannot contain a port, so a tunnel must expose the standard HTTPS port.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/documentation/xcode/supporting-associated-domains" rel="noopener noreferrer"&gt;Supporting associated domains (Apple)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/documentation/bundleresources/entitlements/com.apple.developer.associated-domains" rel="noopener noreferrer"&gt;Associated Domains Entitlement (Apple)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/documentation/technotes/tn3155-debugging-universal-links" rel="noopener noreferrer"&gt;TN3155: Debugging universal links (Apple)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/forums/thread/699401" rel="noopener noreferrer"&gt;Apple Developer Forums: verifying that Apple’s CDN has the latest file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.android.com/training/app-links/verify-applinks" rel="noopener noreferrer"&gt;Verify App Links (Android Developers)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.android.com/training/app-links/configure-assetlinks" rel="noopener noreferrer"&gt;Configure website associations and dynamic rules (Android Developers)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.android.com/training/app-links/test-applinks" rel="noopener noreferrer"&gt;Test App Links (Android Developers)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ngrok.com/blog-post/free-static-domains-ngrok-users" rel="noopener noreferrer"&gt;Static domains for all ngrok users&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ngrok.com/docs/pricing-limits/free-plan-limits" rel="noopener noreferrer"&gt;ngrok free plan limits&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.cloudflare.com/tunnel/concepts/" rel="noopener noreferrer"&gt;Cloudflare Tunnel concepts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/do-more-with-tunnels/trycloudflare/" rel="noopener noreferrer"&gt;Cloudflare Quick Tunnels&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://instatunnel.my/blog/your-deep-link-opens-safari-not-your-app-testing-universal-links-and-android-app-links-through-a-tunnel" rel="noopener noreferrer"&gt;https://instatunnel.my/blog/your-deep-link-opens-safari-not-your-app-testing-universal-links-and-android-app-links-through-a-tunnel&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
    <item>
      <title>Your Webhook Got Switched Off While Your Laptop Slept: Webhook Auto-Disable Rules by Provider (2026)</title>
      <dc:creator>InstaTunnel</dc:creator>
      <pubDate>Wed, 25 Nov 2026 01:41:44 +0000</pubDate>
      <link>https://dev.to/instatunnel/your-webhook-got-switched-off-while-your-laptop-slept-webhook-auto-disable-rules-by-provider-2026-3744</link>
      <guid>https://dev.to/instatunnel/your-webhook-got-switched-off-while-your-laptop-slept-webhook-auto-disable-rules-by-provider-2026-3744</guid>
      <description>&lt;p&gt;You closed the lid on Friday. On Monday you open your laptop, start your tunnel, trigger a test event, and nothing arrives. The tunnel is healthy. Your handler is fine. The provider simply stopped sending.&lt;/p&gt;

&lt;p&gt;This is one of the most confusing failures in local webhook development, because nothing in your code changed. While your machine was asleep, the provider was failing to reach you, and most providers kept retrying before deciding your endpoint was dead. Depending on the provider, that can mean four failures in a row (GitLab, temporarily), ten (Contentstack), 100 over at least six days (Ironclad), two weeks of silence (Vipps MobilePay), or a failure rate measured over an hour (Slack).&lt;/p&gt;

&lt;p&gt;This guide collects the &lt;strong&gt;webhook auto-disable rules&lt;/strong&gt; for Contentstack, Ironclad, Vipps MobilePay, GitLab, Slack, Shopify, Stripe and GitHub, checked against provider documentation and developer guides in November 2026. It also covers how to re-enable a disabled webhook and why a perfectly reasonable &lt;code&gt;401&lt;/code&gt; or &lt;code&gt;410&lt;/code&gt; from a development handler can silently damage a registration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why providers disable failing webhook endpoints
&lt;/h2&gt;

&lt;p&gt;Providers disable endpoints for the same reason electrical systems have circuit breakers. Contentstack describes its circuit breaker as protecting both sides: your endpoint is not flooded with retries while it is down, and the platform does not spend delivery attempts on an unresponsive URL.&lt;/p&gt;

&lt;p&gt;For a developer using a tunnel, the risk is higher than for a production service. A laptop sleeps, a Wi-Fi network changes, or a session expires. The provider sees only a stream of failures and cannot tell “developer went home” from “company shut down the service”.&lt;/p&gt;

&lt;p&gt;The rules are not standardized. Some providers count consecutive failures (Contentstack, GitLab), one measures a failure rate (Slack), some wait for a time window (Ironclad, Vipps MobilePay), and some delete the registration or subscription instead of pausing it (Vipps MobilePay, Shopify).&lt;/p&gt;

&lt;p&gt;That difference decides how a weekend away plays out. Count-based rules trip according to how many events fire while you are gone. Time-based rules trip according to how long you are gone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Webhook auto-disable rules at a glance
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Provider&lt;/th&gt;
&lt;th&gt;What counts as a failure&lt;/th&gt;
&lt;th&gt;When it switches off&lt;/th&gt;
&lt;th&gt;What happens&lt;/th&gt;
&lt;th&gt;Recovery&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Contentstack&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Invalid domain, 30-second timeout, aborted connection, 5xx, 401&lt;/td&gt;
&lt;td&gt;10 consecutive failed deliveries (any 2xx resets the count)&lt;/td&gt;
&lt;td&gt;Status becomes Unhealthy; one email alert&lt;/td&gt;
&lt;td&gt;Fix the cause, re-enable in Settings → Webhooks, then retry missed events from the logs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Ironclad&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;4xx or 5xx (except 410)&lt;/td&gt;
&lt;td&gt;At least 100 consecutive failures spanning at least 6 consecutive days; a 410 disables immediately&lt;/td&gt;
&lt;td&gt;Status &lt;code&gt;disabledBySystem&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Fix the endpoint, then re-enable in the UI or API&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Vipps MobilePay&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;4xx–5xx, or no response within 10 seconds&lt;/td&gt;
&lt;td&gt;Unresponsive for 2 weeks (documented in the March 2026 changelog)&lt;/td&gt;
&lt;td&gt;Registration is deleted&lt;/td&gt;
&lt;td&gt;Register the webhook again&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;GitLab&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;4xx, 5xx, timeouts, other HTTP errors&lt;/td&gt;
&lt;td&gt;4 consecutive failures (temporary); 40 (permanent)&lt;/td&gt;
&lt;td&gt;Temporary disable of 1 minute, growing to a maximum of 24 hours; permanent after 40&lt;/td&gt;
&lt;td&gt;Send a test request that returns 2xx&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Slack Events API&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No 2xx within 3 seconds, SSL failures, more than 2 redirects, non-2xx&lt;/td&gt;
&lt;td&gt;More than 95% of attempts failing within 60 minutes (apps under 1,000 events/hour are exempt)&lt;/td&gt;
&lt;td&gt;Event subscriptions temporarily disabled; owner emailed&lt;/td&gt;
&lt;td&gt;Fix the endpoint, re-enable in the app’s settings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Shopify&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Non-2xx, or no response within 5 seconds&lt;/td&gt;
&lt;td&gt;8 retries over 4 hours, then, if failures persist, removal&lt;/td&gt;
&lt;td&gt;Subscription removed; no deliveries until recreated&lt;/td&gt;
&lt;td&gt;Recreate shop-specific subscriptions and import missing data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Stripe&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Non-2xx (redirects count as failures), timeouts, TLS errors&lt;/td&gt;
&lt;td&gt;Live-mode retries run up to 3 days; a warning email states the date of automatic disabling after multiple days of failure&lt;/td&gt;
&lt;td&gt;Endpoint disabled&lt;/td&gt;
&lt;td&gt;Re-enable the endpoint; resend missed events manually&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;GitHub.com&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No response within 10 seconds, or a 4xx/5xx response&lt;/td&gt;
&lt;td&gt;No automatic redelivery; the failed-delivery docs describe no automatic disabling&lt;/td&gt;
&lt;td&gt;Failed deliveries stay failed&lt;/td&gt;
&lt;td&gt;Redeliver manually or with a script&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Providers change these thresholds. Vipps MobilePay introduced its two-week removal in March 2026. GitLab announced its 4xx/5xx self-healing change in 2024 and shipped it in GitLab 17.11. Check the linked docs before relying on any number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Provider-by-provider rules
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Contentstack: 10 failures and the webhook is Unhealthy
&lt;/h3&gt;

&lt;p&gt;Contentstack retries each individual event up to four times with exponential backoff, after roughly 5, 25, 125 and 625 seconds. Separately, it tracks consecutive failed deliveries for the webhook as a whole. After 10 in a row with no success in between, the circuit breaker trips, the webhook is disabled and marked &lt;strong&gt;Unhealthy&lt;/strong&gt;, and the owner gets a single email.&lt;/p&gt;

&lt;p&gt;A delivery counts as failed when the domain is invalid or does not resolve, the destination does not respond within 30 seconds, the connection is aborted, the response is in the 5xx range, or the response is a &lt;strong&gt;401&lt;/strong&gt;. A single 2xx resets the counter to zero.&lt;/p&gt;

&lt;p&gt;Three details matter for tunnel users:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If several webhooks point at the same URL and also breach the threshold, they are disabled together.&lt;/li&gt;
&lt;li&gt;The alert goes to the addresses you list in the &lt;strong&gt;Email Addresses to Notify&lt;/strong&gt; field when creating the webhook (up to 10). Fill it in, or you may not hear about the shutdown.&lt;/li&gt;
&lt;li&gt;Re-enabling resets the failure count but replays nothing. Events that fired while the webhook was disabled stay missed unless you retry them one by one from the webhook logs, and you must re-enable first, because retry does not work on a disabled webhook.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Contentstack’s own webhook documentation also notes that a webhook does not trigger on local environments such as localhost, so a tunnel’s public URL is what you register.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ironclad: 100 failures, but only across at least 6 days
&lt;/h3&gt;

&lt;p&gt;Ironclad’s rule is easy to misquote. It does not disable after 100 failures alone. The webhook must fail at least 100 consecutive times &lt;em&gt;and&lt;/em&gt; those failures must span a minimum of six consecutive days with no successful delivery in between. Ironclad’s own example of a two-hour outage with 503 responses does not trigger deactivation, and once your service returns 200 again the count resets.&lt;/p&gt;

&lt;p&gt;A 4xx or 5xx response increments the counter, with one exception: &lt;strong&gt;410 Gone&lt;/strong&gt; disables the webhook immediately, on the logic that the endpoint is permanently unavailable.&lt;/p&gt;

&lt;p&gt;Because every failed attempt counts, including each retry, one stubborn event can add many failures quickly. Ironclad retries most errors up to 10 times over 13.6 hours with exponential backoff (initial delay 5 seconds, base factor 3). That makes the six-day minimum the real gate.&lt;/p&gt;

&lt;p&gt;Retries have their own quirk. A &lt;strong&gt;400, 401, 405 or 422&lt;/strong&gt; response is not retried: the delivery fails after one attempt and that event is not redelivered, although it still counts toward deactivation. Ironclad’s guidance is to return 429 or a 5xx for temporary trouble, so that it retries, and to reserve the other codes for requests that will never succeed.&lt;/p&gt;

&lt;p&gt;A webhook that Ironclad disabled shows the status &lt;code&gt;disabledBySystem&lt;/code&gt;, which is distinct from &lt;code&gt;disabled&lt;/code&gt;, meaning a user turned it off. The API exposes &lt;code&gt;consecutiveFailureCount&lt;/code&gt; and &lt;code&gt;firstConsecutiveFailure&lt;/code&gt;, so you can watch the counter climb before anything is switched off. Deactivations are logged to Ironclad’s Errors dashboard, where you can subscribe to notifications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Vipps MobilePay: registrations deleted after two weeks
&lt;/h3&gt;

&lt;p&gt;Vipps MobilePay does not just pause a failing webhook. Its March 2026 changelog entry says it now automatically removes registrations that have been unresponsive for two weeks, and the current API guide repeats the warning. The recovery step is blunt: when your server is back, register the webhook again.&lt;/p&gt;

&lt;p&gt;Production retries follow a long schedule. Attempts 1 to 4 are two seconds apart, attempt 5 waits 60 seconds, attempt 6 waits 120 seconds, attempts 7 to 29 are hourly, and after that retries are daily, ending after seven days. A failure is a 4xx or 5xx response, or no response within 10 seconds. The test environment retries only three times.&lt;/p&gt;

&lt;p&gt;Delivery order is guaranteed per registered webhook. If your server returns a 500 for an AUTHORIZATION notification, the CAPTURE notification for the same payment waits until a retry of the first succeeds. Vipps MobilePay also recommends tracking payment status with both webhooks and polling, rather than relying on webhooks alone.&lt;/p&gt;

&lt;p&gt;The business portal has a Webhook errors tab showing the status codes your endpoint returned, useful for catching a failing registration before it is removed. At the time of writing, the limit is up to 30 registrations per event type per merchant serial number (QR events: one).&lt;/p&gt;

&lt;h3&gt;
  
  
  GitLab: four strikes, then a backoff
&lt;/h3&gt;

&lt;p&gt;GitLab is the most aggressive provider here. Project and group webhooks that fail four consecutive times are &lt;strong&gt;temporarily disabled&lt;/strong&gt; for one minute. The duration grows on later failures, up to a maximum of 24 hours, and the webhook re-enables itself when the period ends. After 40 consecutive failures, the webhook is &lt;strong&gt;permanently disabled&lt;/strong&gt; and does not come back by itself.&lt;/p&gt;

&lt;p&gt;Failure means a 4xx or 5xx response, a timeout, or another HTTP error. GitLab treats all of these the same way, which is the change introduced in GitLab 17.11: 4xx errors used to cause permanent disabling and can now self-heal. On GitLab Self-Managed, automatic disabling is controlled by a feature flag, so check your instance.&lt;/p&gt;

&lt;p&gt;To re-enable a disabled webhook, send a test request from &lt;strong&gt;Settings → Webhooks&lt;/strong&gt;. The webhook is re-enabled if the test returns a 2xx. The &lt;strong&gt;Recent events&lt;/strong&gt; section keeps the last two days of requests and offers &lt;strong&gt;Resend Request&lt;/strong&gt;, though you cannot resend if the webhook URL has changed.&lt;/p&gt;

&lt;p&gt;GitLab’s receiver guidance is useful for dev handlers: respond quickly with 200 or 201, process asynchronously, and return 4xx only for misconfigured webhooks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Slack: a failure rate, not a failure count
&lt;/h3&gt;

&lt;p&gt;Slack’s Events API uses a rate. If more than 95% of delivery attempts fail within 60 minutes, Slack temporarily disables your app’s event subscriptions and emails the owner. Timeouts, SSL failures, more than two redirects and non-2xx responses all count, and retries count toward the total. Delivery stays off until you re-enable it in your app’s settings.&lt;/p&gt;

&lt;p&gt;Slack expects a 2xx within three seconds, then retries three times: nearly immediately, after one minute and after five minutes. With the &lt;strong&gt;Delayed Events&lt;/strong&gt; option turned on, hourly retries continue for up to 24 hours. By default Slack does not attempt an event more than two hours late.&lt;/p&gt;

&lt;p&gt;There is a useful exemption for developers: apps receiving fewer than 1,000 events per hour are not automatically disabled. A lightly used development app is therefore unlikely to trip this rule, though a busy workspace might.&lt;/p&gt;

&lt;p&gt;These Slack figures come from Hookdeck’s guide to Slack webhooks, which summarizes Slack’s Events API documentation. Confirm them in Slack’s own docs before depending on them.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shopify: eight retries, then removal
&lt;/h3&gt;

&lt;p&gt;Shopify retries a failed delivery up to eight times over four hours and expects a response within five seconds. If failures persist, the subscription is removed. Shopify’s troubleshooting guide does not give an exact removal threshold beyond “multiple failed delivery attempts”, and a removed subscription receives nothing until you recreate it.&lt;/p&gt;

&lt;p&gt;Recovery depends on how the subscription was created. App-specific subscriptions, declared in your app configuration, do not need re-subscribing. Shop-specific ones must be recreated by whatever code created them, and Shopify suggests adding a check that fetches existing subscriptions and creates only the missing ones. After an outage, import the missing data by fetching records from the outage period and feeding them into your webhook processing code.&lt;/p&gt;

&lt;p&gt;Retried webhooks carry the original payload and go to the address configured when the event was triggered, so changing the URL mid-retry does not redirect them. Use the &lt;code&gt;X-Shopify-Triggered-At&lt;/code&gt; header or a payload timestamp to detect stale deliveries. The Dev Dashboard shows delivery metrics and 7 days of logs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stripe: three days of retries
&lt;/h3&gt;

&lt;p&gt;In live mode, Stripe retries a given event for up to three days with exponential backoff. For events created in a sandbox, it retries three times over a few hours. Stripe counts redirects as failures, so point the endpoint at the final URL.&lt;/p&gt;

&lt;p&gt;Stripe’s documentation says it emails you when an endpoint has not returned a 2xx for multiple days in a row, and that the email states when the endpoint will be automatically disabled. It does not publish a single fixed number of days, so treat the date in that email as the deadline.&lt;/p&gt;

&lt;p&gt;Disabling has a sharp edge: if an endpoint is disabled or deleted when a retry comes due, that event’s future retries are prevented. Disabling and re-enabling before the next retry keeps the retries alive.&lt;/p&gt;

&lt;p&gt;Missed events can be resent manually. The Dashboard &lt;strong&gt;Resend&lt;/strong&gt; button works for up to 15 days after the event was created. The CLI command &lt;code&gt;stripe events resend &amp;lt;event_id&amp;gt; --webhook-endpoint=&amp;lt;endpoint_id&amp;gt;&lt;/code&gt; works for up to 30 days. A manual resend does not cancel Stripe’s automatic retries.&lt;/p&gt;

&lt;p&gt;For local development, Stripe’s docs suggest a tunnelling tool for a temporary public HTTPS URL, or &lt;code&gt;stripe listen --forward-to localhost:4242/webhook&lt;/code&gt; to forward events without registering a public URL at all.&lt;/p&gt;

&lt;h3&gt;
  
  
  GitHub: no auto-redelivery, short timeout
&lt;/h3&gt;

&lt;p&gt;GitHub’s documentation states that it does not automatically redeliver failed webhook deliveries. On GitHub.com, a delivery is recorded as failed if your server is down or takes longer than &lt;strong&gt;10 seconds&lt;/strong&gt; to respond. GitHub Enterprise Server’s documentation (for example, versions 3.14 and 3.17) says &lt;strong&gt;30 seconds&lt;/strong&gt;, so the timeout that applies depends on where your repository lives. The failed-delivery page describes no automatic disabling.&lt;/p&gt;

&lt;p&gt;For laptops, “no auto-redelivery” is its own trap. Events that arrive while you are offline stay failed until you redeliver them from the UI, or until a script lists deliveries whose status is not &lt;code&gt;OK&lt;/code&gt; and redelivers them through the REST API. GitHub documents example scripts for repository, organization and GitHub App webhooks.&lt;/p&gt;

&lt;p&gt;GitHub’s Enterprise Server troubleshooting docs also state that &lt;code&gt;localhost&lt;/code&gt; and &lt;code&gt;127.0.0.1&lt;/code&gt; are not supported as webhook URLs, and point to webhook-forwarding services such as smee.io for local testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 401 and 410 traps in development handlers
&lt;/h2&gt;

&lt;p&gt;Providers treat status codes as a health signal. Two deserve special attention.&lt;/p&gt;

&lt;h3&gt;
  
  
  401: the “protect my tunnel” gotcha
&lt;/h3&gt;

&lt;p&gt;Putting authentication in front of a public tunnel is sensible security. The problem is what the &lt;em&gt;sender&lt;/em&gt; sees.&lt;/p&gt;

&lt;p&gt;If your tunnel answers unauthenticated requests with &lt;code&gt;401 Unauthorized&lt;/code&gt;, which is what an HTTP Basic Auth challenge does, the provider treats each one as a failed delivery. InstaTunnel’s CLI documents an &lt;code&gt;--auth username:password&lt;/code&gt; flag for exactly this kind of protection. The same logic applies if your own handler middleware rejects a request with a 401 because a signature or token check failed.&lt;/p&gt;

&lt;p&gt;How each provider reacts differs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Contentstack&lt;/strong&gt; counts a 401 toward its 10-failure limit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ironclad&lt;/strong&gt; counts it as a failure but does not retry the event, so that event is gone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitLab, Vipps MobilePay, Stripe and Shopify&lt;/strong&gt; treat any 4xx or non-2xx response as a failed delivery.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The fix is to make the sender authenticate, or to leave the webhook path unauthenticated and rely on signature verification instead. Contentstack’s Basic Auth is available by default, and its documentation says the username and password should be unique and not reused from any other login. OAuth 2.0 and bearer-token authentication must be enabled for your organization by contacting Contentstack support. If your tunnel has Basic Auth enabled, enter the same credentials in the webhook’s Basic Auth fields, then send one test event and confirm a 2xx before you leave it unattended.&lt;/p&gt;

&lt;h3&gt;
  
  
  410: the response that means “never again”
&lt;/h3&gt;

&lt;p&gt;A 410 means “this resource is permanently gone”. Of the providers reviewed for this guide, only Ironclad documents a special case: one 410 disables the webhook immediately. Ironclad presents this as a feature. When you migrate to a new endpoint, you can make the old one return 410 to retire it cleanly.&lt;/p&gt;

&lt;p&gt;The risk is accidental. A dev server whose route was removed, a catch-all handler that returns 410 for unknown paths, or a framework default after a refactor can all send one. A single stray 410 during a branch switch could switch off a registration that would otherwise have survived days of downtime. Before you add a catch-all, check which provider you are behind, and prefer 404 or 503 for “not here right now”. With Ironclad specifically, return a 5xx or 429 when you want a retry.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to re-enable a disabled webhook
&lt;/h2&gt;

&lt;p&gt;Re-enabling is straightforward, but order matters.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fix the cause first.&lt;/strong&gt; Contentstack warns that re-enabling before the underlying issue is fixed means another 10 failures and another disable. Ironclad’s docs likewise say to re-enable once the underlying issue is resolved.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Re-enable or re-register.&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Contentstack:&lt;/strong&gt; Settings → Webhooks → ellipsis in the Actions column → Enable (or use the Enable Webhook toggle), then Save.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ironclad:&lt;/strong&gt; Company Settings → API → Webhooks, or the Update a Webhook API call. Re-enabling clears the failure counters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vipps MobilePay:&lt;/strong&gt; register a new webhook.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shopify:&lt;/strong&gt; recreate shop-specific subscriptions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitLab:&lt;/strong&gt; send a test request that returns a 2xx.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slack:&lt;/strong&gt; re-enable event subscriptions in your app’s settings.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replay what you missed.&lt;/strong&gt; Disabled periods are usually not backfilled. Use Contentstack’s per-execution Retry, GitLab’s Resend Request (last two days), Stripe’s resend (15 days in the Dashboard, 30 via CLI), GitHub’s redelivery API, or, for Shopify, an import of data from the outage window.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Send one test event&lt;/strong&gt; and confirm a 2xx before walking away.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Check the provider’s status before you debug your code
&lt;/h2&gt;

&lt;p&gt;Most providers expose enough to tell “they stopped sending” from “my tunnel stopped receiving”:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Contentstack:&lt;/strong&gt; webhook logs and the Unhealthy status.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ironclad:&lt;/strong&gt; &lt;code&gt;status&lt;/code&gt;, &lt;code&gt;consecutiveFailureCount&lt;/code&gt; and &lt;code&gt;firstConsecutiveFailure&lt;/code&gt; through the API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vipps MobilePay:&lt;/strong&gt; the Webhook errors tab in the business portal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitLab:&lt;/strong&gt; Recent events and the Temporarily disabled or Disabled badge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shopify:&lt;/strong&gt; delivery metrics and logs in the Dev Dashboard.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stripe:&lt;/strong&gt; the Event deliveries tab in Workbench.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; the recent deliveries log, or the REST API’s list-deliveries endpoints.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Compare that view against your tunnel’s request log. If the provider shows failed deliveries during the hours your laptop was asleep, the webhook was working and you were simply offline.&lt;/p&gt;

&lt;h2&gt;
  
  
  A checklist for keeping local webhooks alive
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Know the clock.&lt;/strong&gt; A webhook that survives two weeks at Vipps MobilePay can be temporarily disabled after four failures at GitLab.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use a stable URL.&lt;/strong&gt; A changing tunnel hostname leaves providers sending to an address that no longer exists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Register the public URL, never localhost.&lt;/strong&gt; Contentstack, GitHub and Stripe all require a publicly reachable address, or a forwarding tool such as the Stripe CLI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Return 2xx quickly.&lt;/strong&gt; Acknowledge first, process afterwards. Timeouts differ widely: Slack 3 seconds, Shopify 5, GitHub.com and Vipps MobilePay 10, Contentstack 30.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Watch the status codes.&lt;/strong&gt; Avoid 401 and 410 unless you mean them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subscribe to failure notifications.&lt;/strong&gt; Fill in Contentstack’s Email Addresses to Notify field, subscribe to Ironclad’s Errors dashboard alerts, and watch the inbox for Slack and Stripe warnings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plan to reconcile.&lt;/strong&gt; Several providers do not backfill, so keep a way to fetch or resend what you missed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep request logs.&lt;/strong&gt; They show whether the provider stopped sending or your tunnel stopped receiving.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Does Ironclad disable a webhook after 100 failures?
&lt;/h3&gt;

&lt;p&gt;Only if those 100 or more consecutive failures span at least six consecutive days with no success in between. A 410 response disables it immediately.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do events sent during the outage come back after I re-enable?
&lt;/h3&gt;

&lt;p&gt;Usually not automatically. Contentstack requires you to retry each missed event from the logs, GitHub does not redeliver on its own, and Shopify expects you to import the missing data. Stripe lets you resend events manually for 15 to 30 days.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does GitHub disable webhooks that fail?
&lt;/h3&gt;

&lt;p&gt;GitHub’s failed-delivery documentation describes no automatic disabling. It says failed deliveries are not automatically redelivered, so you redeliver them yourself.&lt;/p&gt;

&lt;h3&gt;
  
  
  How fast can a webhook be switched off?
&lt;/h3&gt;

&lt;p&gt;GitLab can temporarily disable a webhook after four consecutive failures, and Ironclad disables one immediately on a 410. At the other extreme, Vipps MobilePay waits two weeks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Auto-disable rules exist to protect providers from dead endpoints, and a sleeping laptop looks exactly like a dead endpoint. The practical lessons are short: learn each provider’s threshold, keep your URL stable, answer quickly with a 2xx, treat 401 and 410 as meaningful signals rather than convenient defaults, and check your provider dashboard whenever events stop. When the tunnel is up and nothing arrives, look at the webhook’s status before you look at your code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.contentstack.com/docs/headless-cms/webhook-circuit-breaker" rel="noopener noreferrer"&gt;Contentstack: Webhook Circuit Breaker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.contentstack.com/docs/headless-cms/create-a-webhook" rel="noopener noreferrer"&gt;Contentstack: Create a Webhook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.ironcladapp.com/reference/webhook-deactivation" rel="noopener noreferrer"&gt;Ironclad: Webhook Deactivation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.ironcladapp.com/reference/webhooks" rel="noopener noreferrer"&gt;Ironclad: Webhooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.vippsmobilepay.com/docs/APIs/webhooks-api/api-guide/" rel="noopener noreferrer"&gt;Vipps MobilePay: Webhooks API guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.vippsmobilepay.com/docs/APIs/webhooks-api/CHANGELOG.md" rel="noopener noreferrer"&gt;Vipps MobilePay: Webhooks API changelog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.gitlab.com/user/project/integrations/webhooks/" rel="noopener noreferrer"&gt;GitLab Docs: Webhooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://about.gitlab.com/blog/gitlab-webhooks-get-smarter-with-self-healing-capabilities/" rel="noopener noreferrer"&gt;GitLab: Webhooks get smarter with self-healing capabilities&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hookdeck.com/webhooks/slack/guide-duplicates-ordering-retries-timeouts" rel="noopener noreferrer"&gt;Hookdeck: Slack webhooks in production&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://shopify.dev/docs/apps/build/webhooks/troubleshoot" rel="noopener noreferrer"&gt;Shopify: Troubleshoot webhooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://shopify.dev/changelog/updates-to-webhook-retry-mechanism" rel="noopener noreferrer"&gt;Shopify changelog: Updates to webhook retry mechanism&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.stripe.com/webhooks" rel="noopener noreferrer"&gt;Stripe: Receive events in your webhook endpoint&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/webhooks/using-webhooks/handling-failed-webhook-deliveries" rel="noopener noreferrer"&gt;GitHub Docs: Handling failed webhook deliveries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/ko/enterprise-server@3.17/webhooks/testing-and-troubleshooting-webhooks/troubleshooting-webhooks" rel="noopener noreferrer"&gt;GitHub Enterprise Server 3.17 docs: Troubleshooting webhooks (Korean locale)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cdn.jsdelivr.net/npm/instatunnel@1.1.23/README.md" rel="noopener noreferrer"&gt;InstaTunnel CLI README&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://instatunnel.my/blog/your-webhook-got-switched-off-while-your-laptop-slept-webhook-auto-disable-rules-by-provider-2026" rel="noopener noreferrer"&gt;https://instatunnel.my/blog/your-webhook-got-switched-off-while-your-laptop-slept-webhook-auto-disable-rules-by-provider-2026&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>security</category>
    </item>
    <item>
      <title>The Reconnect Stampede: Idempotency, Duplicate Deliveries and Out-of-Order Events When Your Tunnel Comes Back</title>
      <dc:creator>InstaTunnel</dc:creator>
      <pubDate>Tue, 24 Nov 2026 02:35:32 +0000</pubDate>
      <link>https://dev.to/instatunnel/the-reconnect-stampede-idempotency-duplicate-deliveries-and-out-of-order-events-when-your-tunnel-43d2</link>
      <guid>https://dev.to/instatunnel/the-reconnect-stampede-idempotency-duplicate-deliveries-and-out-of-order-events-when-your-tunnel-43d2</guid>
      <description>&lt;p&gt;You closed the laptop on Friday with a webhook endpoint registered. On Monday the tunnel reconnected and your terminal started scrolling. Some payloads look familiar. Some you handled days ago. A few describe an order being shipped before it was created.&lt;/p&gt;

&lt;p&gt;That is the reconnect stampede. Webhook providers retry failed deliveries and warn that the same event can arrive more than once. A tunnel that was offline leaves you with retries, manual redeliveries and stale payloads mixed in with fresh traffic. This guide covers the part that decides whether that mix is harmless or expensive: &lt;strong&gt;webhook idempotency, deduplication keys, event IDs, ordering and safe replay&lt;/strong&gt;. It uses current documentation from Stripe, GitHub, Shopify, Slack and the Standard Webhooks specification, checked in November 2026.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Webhook Providers Do While Your Tunnel Is Down
&lt;/h2&gt;

&lt;p&gt;A tunnel does not queue anything. When your machine is offline, the public URL cannot reach your app. The sender sees an error or a timeout and applies its own retry policy. Those policies differ a lot:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Provider&lt;/th&gt;
&lt;th&gt;Automatic retries&lt;/th&gt;
&lt;th&gt;Manual replay&lt;/th&gt;
&lt;th&gt;Dedupe identifier&lt;/th&gt;
&lt;th&gt;Response limit&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Stripe&lt;/td&gt;
&lt;td&gt;Live mode: exponential backoff for up to 3 days. Sandbox: 3 attempts over a few hours&lt;/td&gt;
&lt;td&gt;Dashboard “Resend” up to 15 days after the event; &lt;code&gt;stripe events resend&lt;/code&gt; up to 30 days&lt;/td&gt;
&lt;td&gt;&lt;code&gt;event.id&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Return a 2xx “quickly” (no number given)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GitHub&lt;/td&gt;
&lt;td&gt;None. Failed deliveries are not redelivered automatically&lt;/td&gt;
&lt;td&gt;Redeliver deliveries from the past 3 days, in the UI or via the REST API&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;X-GitHub-Delivery&lt;/code&gt; (unchanged on redelivery)&lt;/td&gt;
&lt;td&gt;10 seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shopify&lt;/td&gt;
&lt;td&gt;8 retries over about 4 hours&lt;/td&gt;
&lt;td&gt;None documented; Shopify recommends reconciliation jobs&lt;/td&gt;
&lt;td&gt;&lt;code&gt;X-Shopify-Webhook-Id&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;1-second connection timeout, 5 seconds for the whole request&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Slack (Events API)&lt;/td&gt;
&lt;td&gt;3 retries: nearly immediately, after about 1 minute, after about 5 minutes. Optional “Delayed Events” adds hourly retries for 24 hours&lt;/td&gt;
&lt;td&gt;None documented&lt;/td&gt;
&lt;td&gt;&lt;code&gt;event_id&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;3 seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Standard Webhooks senders&lt;/td&gt;
&lt;td&gt;The spec recommends a multi-day schedule with exponential backoff and jitter&lt;/td&gt;
&lt;td&gt;The spec calls manual replay “immensely important” for recovering from long outages&lt;/td&gt;
&lt;td&gt;&lt;code&gt;webhook-id&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The spec recommends 15 to 30 seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Several consequences matter for a developer machine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sandbox events die quickly.&lt;/strong&gt; Stripe retries sandbox events only three times over a few hours. A laptop that slept overnight has missed them, and nothing will drain on reconnect. You can still resend them manually from the Workbench Event deliveries tab.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shopify can delete the subscription.&lt;/strong&gt; After 8 consecutive failures, Shopify deletes a subscription that was configured through the Admin API. The retry run lasts about four hours, so an overnight sleep can outlast it. Subscriptions declared in &lt;code&gt;shopify.app.toml&lt;/code&gt; are reported not to be deleted, but the abandoned delivery is still gone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub never retries.&lt;/strong&gt; Nothing arrives on its own after an outage. You redeliver deliveries from the past 3 days, or you reconcile from the API.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slack can switch your subscriptions off.&lt;/strong&gt; Retries count toward Slack’s failure limit. If more than 95% of delivery attempts fail within 60 minutes, Slack temporarily disables your app’s event subscriptions. Hookdeck’s guide reports an exemption for apps receiving fewer than 1,000 events an hour, which covers most dev apps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stripe drops retries for a deleted endpoint.&lt;/strong&gt; If a destination is disabled or deleted when Stripe attempts a retry, Stripe prevents future retries of that event. If you disable and then re-enable the destination before the retry fires, the retry still happens. Events generated while a destination is disabled are never resent.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Three Different Problems Hiding in One Stampede
&lt;/h2&gt;

&lt;p&gt;Reconnecting creates three separate failure modes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Backlog drain.&lt;/strong&gt; Sender retries run on each event’s own backoff schedule, so they trickle in rather than landing in one instant. The sharp burst usually comes from your own catch-up: manual resends and reconciliation jobs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Duplicates.&lt;/strong&gt; The same delivery arrives twice, or two deliveries describe one change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reordering.&lt;/strong&gt; Old events arrive next to new ones.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Dedupe handles the second, version checks handle the third, and a controlled replay procedure handles the first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pick the Right Dedupe Key
&lt;/h2&gt;

&lt;p&gt;Webhook deduplication starts with choosing which identifier you trust. There are three layers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Delivery or event IDs from the sender.&lt;/strong&gt; These are your first line of defense:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stripe:&lt;/strong&gt; log the event IDs you have processed and skip repeats. Stripe documents that the same event can be delivered more than once. Do not use &lt;code&gt;created&lt;/code&gt; to decide whether you have seen an event, because snapshot events record it in whole seconds and distinct events can share a timestamp.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;code&gt;X-GitHub-Delivery&lt;/code&gt; identifies the delivery, and GitHub states it is the same on a redelivery as on the original. That makes it a stable key.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shopify:&lt;/strong&gt; use &lt;code&gt;X-Shopify-Webhook-Id&lt;/code&gt; to skip duplicate deliveries. &lt;code&gt;X-Shopify-Event-Id&lt;/code&gt; is different. If you have several subscriptions for one topic, each delivery carries its own Webhook ID but they share an Event ID. Use the Event ID to correlate deliveries from one merchant action, not to dedupe.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Standard Webhooks:&lt;/strong&gt; the &lt;code&gt;webhook-id&lt;/code&gt; header is the intended idempotency key. Per the specification, it stays the same however many times a failed delivery is retried. The &lt;code&gt;webhook-timestamp&lt;/code&gt; changes on each attempt, because it records when the attempt was made, not when the event happened. The spec’s own example keeps IDs for 5 minutes, which suits replay-attack protection. It does not cover the multi-day windows in this guide.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slack:&lt;/strong&gt; use &lt;code&gt;event_id&lt;/code&gt; from the payload. Slack describes it as a globally unique identifier for the event. Hookdeck notes that Slack’s docs do not state outright that a retry repeats the value, so confirm it in your own logs. Do not drop a request just because &lt;code&gt;x-slack-retry-num&lt;/code&gt; is present. That header says Slack is retrying, not that your first attempt finished.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Business keys.&lt;/strong&gt; Sender IDs only protect you from the same delivery arriving twice. Stripe documents that in some cases two separate Event objects are generated for one change. To catch those, combine the ID of the object in &lt;code&gt;data.object&lt;/code&gt; with the &lt;code&gt;event.type&lt;/code&gt;. Setting a subscription to &lt;code&gt;active&lt;/code&gt; when it already is should be a no-op, not an error. A key such as &lt;code&gt;topic + resource ID&lt;/code&gt; catches what an event ID cannot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Downstream idempotency keys.&lt;/strong&gt; Your handler may call other systems: a mailer, a payment API, a queue. Pass the event ID along as their idempotency key where they support one. Stripe’s API accepts an &lt;code&gt;Idempotency-Key&lt;/code&gt; header on all POST requests. Stripe may prune keys once they are at least 24 hours old, and a reused key after that creates a new request. For a replay days later, your own dedupe table must be the source of truth, not the downstream key. A database unique constraint also does nothing for an email you already sent.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Insert-First Pattern for Idempotent Webhook Handlers
&lt;/h2&gt;

&lt;p&gt;The most reliable pattern is to claim the event ID inside the same database transaction as your side effects. The unique constraint does the arbitration, so even two simultaneous deliveries of the same event cannot both win.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;processed_events&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;provider&lt;/span&gt;    &lt;span class="kt"&gt;text&lt;/span&gt;        &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;event_id&lt;/span&gt;    &lt;span class="kt"&gt;text&lt;/span&gt;        &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;received_at&lt;/span&gt; &lt;span class="kt"&gt;timestamptz&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="nb"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/webhooks/stripe"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rawBodyParser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;verifyAndParse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     &lt;span class="c1"&gt;// check the signature on the raw body first&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;pool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"BEGIN"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;rowCount&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="sb"&gt;`INSERT INTO processed_events (provider, event_id)
       VALUES ('stripe', $1) ON CONFLICT DO NOTHING`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rowCount&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;            &lt;span class="c1"&gt;// already handled&lt;/span&gt;
      &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ROLLBACK"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;applyEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     &lt;span class="c1"&gt;// fast database writes only&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"COMMIT"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"ROLLBACK"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;      &lt;span class="c1"&gt;// the claim rolls back with the work&lt;/span&gt;
    &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;             &lt;span class="c1"&gt;// the sender will retry&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;release&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Details that matter:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Return 2xx for a duplicate.&lt;/strong&gt; A duplicate is success. Stripe’s docs say to skip an already-processed event and return 200 to stop further retries. A 4xx or 5xx tells the sender to try again, which keeps the stampede going.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify the signature before the dedupe check.&lt;/strong&gt; Stripe’s guidance for recovery handlers is to verify first, then check whether you have processed the event.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mind the response clocks.&lt;/strong&gt; The limits are 3 seconds for Slack, 5 for Shopify and 10 for GitHub. If the work is slow, store the event and enqueue the job inside the transaction, and let a worker do the rest. Stripe also recommends processing events through an asynchronous queue so that spikes, such as a month-start subscription renewal run, do not overwhelm your endpoint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Roll back the claim on failure.&lt;/strong&gt; If the claim survived a crash, the retry would be skipped as a duplicate and the work would never happen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep side effects that cannot roll back outside the transaction.&lt;/strong&gt; Emails and API calls belong in an outbox table or a job queue, written inside the same transaction and sent afterwards with their own idempotency key.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Size your retention to the replay window.&lt;/strong&gt; Keep processed IDs longer than the longest way an event can come back. For Stripe that is the 30-day CLI resend window. For GitHub it is 3 days. Thirty-five days is a sensible floor if you use both. Pruning at 24 hours reopens the door for a replay on day three.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Handling Out-of-Order Webhook Events
&lt;/h2&gt;

&lt;p&gt;Providers are explicit that order is not something to rely on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stripe:&lt;/strong&gt; event order is not guaranteed. Creating a subscription, for example, can generate &lt;code&gt;customer.subscription.created&lt;/code&gt;, &lt;code&gt;invoice.created&lt;/code&gt;, &lt;code&gt;invoice.paid&lt;/code&gt; and &lt;code&gt;charge.created&lt;/code&gt; in any sequence. Stripe suggests retrieving the missing objects through the API if you receive &lt;code&gt;invoice.paid&lt;/code&gt; first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; deliveries may arrive in a different order than the events took place. GitHub says to use the timestamps in the payload if you need to know when an event occurred relative to another.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shopify:&lt;/strong&gt; ordering is not guaranteed between different topics for the same resource. A &lt;code&gt;products/update&lt;/code&gt; can arrive before &lt;code&gt;products/create&lt;/code&gt;. Retried webhooks are delivered with the original payload from when they were triggered, so a retry can carry stale data. Shopify recommends comparing the &lt;code&gt;X-Shopify-Triggered-At&lt;/code&gt; header or the payload’s &lt;code&gt;updated_at&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slack:&lt;/strong&gt; Hookdeck’s review of Slack’s docs finds no general promise about delivery order.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Standard Webhooks:&lt;/strong&gt; the payload &lt;code&gt;timestamp&lt;/code&gt; records when the event occurred, while the &lt;code&gt;webhook-timestamp&lt;/code&gt; header records the delivery attempt. Never use the attempt timestamp to rank events.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After a reconnect the effect grows: a retry from Friday arrives next to events from this morning. Shopify also warns that webhooks can be delayed by up to a day, so compare the timestamp to the current time if lateness matters.&lt;/p&gt;

&lt;p&gt;Use one or more of these strategies:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Treat the webhook as a nudge, then fetch current state.&lt;/strong&gt; Read the object ID from the event and retrieve the latest version from the provider’s API. Arrival order stops mattering because you always apply the newest truth. The Standard Webhooks spec describes this as the “thin payload” approach, and Stripe’s Workbench labels its thin event payload format as recommended. The cost is extra API calls and rate limits during a drain, so combine it with a queue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Guard writes with a version.&lt;/strong&gt; Store the source’s last-updated marker and refuse to move backwards:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;
&lt;span class="k"&gt;SET&lt;/span&gt;    &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;source_updated_at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$3&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt;  &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$1&lt;/span&gt; &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="n"&gt;source_updated_at&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nv"&gt;$3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="c1"&gt;-- 0 rows updated: stale event (or missing parent). Ignore or park it.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For Shopify, compare the resource’s &lt;code&gt;updated_at&lt;/code&gt; or &lt;code&gt;X-Shopify-Triggered-At&lt;/code&gt;. Do not rely on a Stripe event’s &lt;code&gt;created&lt;/code&gt; value to rank events that may have been generated in the same second.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Model state as a one-way machine.&lt;/strong&gt; &lt;code&gt;pending → paid → refunded&lt;/code&gt; can only move forward. An incoming &lt;code&gt;pending&lt;/code&gt; for an order already &lt;code&gt;paid&lt;/code&gt; is discarded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Park children that arrive before parents.&lt;/strong&gt; If an update refers to a record you have not seen, store the event with a retry counter and revisit after a short delay, then fall back to fetching the parent. Upserts help too, so an update that arrives first still works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Prefer absolute values over deltas.&lt;/strong&gt; “Set inventory to 12” survives duplicates and reordering. “Subtract 1” does not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Safe Replay After You Reconnect
&lt;/h2&gt;

&lt;p&gt;Replay is how you recover events the sender will no longer deliver. It is also how you re-create the stampede on purpose, so do it deliberately.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Let the automatic retries land first.&lt;/strong&gt; Check what arrived before any manual resend. Stripe notes that a manual resend does not cancel the automatic retry schedule, even if it returns a 2xx. Your endpoint can receive the same event twice, which is one more reason for the dedupe table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replay through the production handler path.&lt;/strong&gt; Never write a “catch-up” script that bypasses the dedupe table. Stripe’s own recovery guide warns that a manual recovery script might run more than once while automatic retries are also arriving.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use the sender’s own tools within their windows.&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stripe:&lt;/strong&gt; Dashboard Resend (15 days) or &lt;code&gt;stripe events resend &amp;lt;event_id&amp;gt; --webhook-endpoint=&amp;lt;endpoint_id&amp;gt;&lt;/code&gt; (30 days). To find what you missed, call List Events with &lt;code&gt;delivery_success=false&lt;/code&gt;, a &lt;code&gt;types&lt;/code&gt; filter and &lt;code&gt;ending_before&lt;/code&gt; set to the last event you processed before the outage. Stripe returns only events from the last 30 days, and with auto-pagination you get them in chronological order.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; redeliver from the past 3 days. Only repository admins can redeliver for a repository, and only owners for an organization. GitHub documents a scheduled script that lists deliveries through the REST API, finds any whose &lt;code&gt;status&lt;/code&gt; is not &lt;code&gt;OK&lt;/code&gt; and redelivers them.&lt;/li&gt;
&lt;li&gt;After an outage longer than a provider’s window, reconcile from the REST API instead.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Throttle your own drain.&lt;/strong&gt; Process with limited concurrency, and serialize work per entity (customer, order, repository) so two events for the same record never run in parallel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reconcile what the windows cannot cover.&lt;/strong&gt; Run a job that compares your records with the provider’s API. Shopify says to build reconciliation jobs for critical webhooks, because delivery is not always guaranteed. Stripe also documents a rare case where it fails to generate an event at all. It then sends a &lt;code&gt;v2.core.health.event_generation_failure.resolved&lt;/code&gt; event (public preview) and tells you to poll the API for the affected resource.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Where the Tunnel Fits: Same URL and Request Logs
&lt;/h2&gt;

&lt;p&gt;Every strategy above assumes the sender’s retry has somewhere to land. That is where a stable tunnel URL earns its place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A stable URL keeps retries alive.&lt;/strong&gt; If the tunnel comes back on a different hostname, pending retries go to a dead address and you must re-register the endpoint with each provider. The providers behave differently when you do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shopify delivers a retry to the address that was configured when the webhook was triggered. Updating the subscription’s address mid-retry does not redirect it. Shopify recommends keeping both endpoints active for a short overlap when you migrate.&lt;/li&gt;
&lt;li&gt;Stripe stops retrying an event if the destination is deleted when the retry comes due. Swap by adding the new endpoint first, rather than deleting the old one.&lt;/li&gt;
&lt;li&gt;GitHub rejects &lt;code&gt;localhost&lt;/code&gt; and &lt;code&gt;127.0.0.1&lt;/code&gt; as webhook URLs, so a public tunnel URL is required.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;InstaTunnel’s README documents custom subdomains and recommends a stable subdomain per project. It uses a fixed subdomain for OAuth redirect URIs, and the same idea applies to webhook endpoints:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;instatunnel 3000 --subdomain myapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check your plan’s documentation to confirm the name stays yours while the tunnel is offline. Without that, the stable URL does not protect you.&lt;/p&gt;

&lt;p&gt;Provider tooling can help too. During &lt;code&gt;shopify app dev&lt;/code&gt; the tunnel URL changes on every run, so Shopify recommends a relative &lt;code&gt;uri = "/webhooks"&lt;/code&gt; in your app config. Stripe’s &lt;code&gt;stripe listen --forward-to localhost:4242/webhook&lt;/code&gt; tests handlers without any registered public URL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Webhook helpers.&lt;/strong&gt; The README lists &lt;code&gt;instatunnel webhook init&lt;/code&gt;, &lt;code&gt;verify&lt;/code&gt; and &lt;code&gt;test&lt;/code&gt; commands for Stripe, GitHub, Shopify, Twilio and PayPal. For example, &lt;code&gt;instatunnel webhook init --provider stripe --port 4242 --path /webhooks/stripe&lt;/code&gt; generates the setup commands and dashboard fields. &lt;code&gt;instatunnel doctor --port 3000&lt;/code&gt; checks that your local app is actually listening before you tunnel to it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro request logs.&lt;/strong&gt; &lt;code&gt;instatunnel --logs&lt;/code&gt; polls live request logs, and the README lists request logs as a Pro/Business feature. After a reconnect, the log is the quickest way to see what the stampede actually looked like: which requests arrived, in what order, how many times the same ID showed up, and which responses your app returned. Log the event ID in your own handler as well. Then you can match a tunnel log line to a row in &lt;code&gt;processed_events&lt;/code&gt; and confirm that duplicates were skipped, not re-run.&lt;/p&gt;

&lt;p&gt;A tunnel is a pipe, not a queue. It does not hold events while you are offline. If you need durable buffering, put a queue or an event gateway in front of your app. For local development, a stable URL plus a dedupe table covers most of the risk.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Local Stampede Test Checklist
&lt;/h2&gt;

&lt;p&gt;Do not wait for a real outage. Rehearse it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Kill and revive.&lt;/strong&gt; Stop the tunnel for ten minutes while you trigger events (&lt;code&gt;stripe trigger payment_intent.succeeded&lt;/code&gt; or a test order), then reconnect and watch the logs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Double-send.&lt;/strong&gt; Post the same payload twice with the same ID using &lt;code&gt;curl&lt;/code&gt;. Assert that the second returns 200 and changes nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Race it.&lt;/strong&gt; Send two identical deliveries at the same moment. Exactly one should apply.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flip the order.&lt;/strong&gt; Deliver an update before its create event, then an older update after a newer one. The final state must match the newest version.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fail halfway.&lt;/strong&gt; Throw an error after the side effect but before the commit, then retry. The work should happen once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resend from the past.&lt;/strong&gt; Use &lt;code&gt;stripe events resend&lt;/code&gt; for an old event and confirm your dedupe row stops it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Time out on purpose.&lt;/strong&gt; Add a 6-second sleep to your handler. Shopify and Slack will treat the response as a failure and retry, and your dedupe table should absorb it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Do webhook providers guarantee exactly-once delivery?&lt;/strong&gt; No. Stripe and Shopify both document that the same event can arrive more than once. GitHub documents redeliveries that reuse the original delivery ID. The Standard Webhooks spec treats its &lt;code&gt;webhook-id&lt;/code&gt; as an idempotency key for the same reason. Your handler must tolerate repeats.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long should I keep processed event IDs?&lt;/strong&gt; At least as long as the longest replay window you use. For Stripe’s 30-day CLI resend, keep roughly 35 days.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does returning 200 for a duplicate stop the retries?&lt;/strong&gt; For Stripe, yes. Its docs say to skip an already-processed event and return a 200 to stop further retries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Will my tunnel replay missed webhooks?&lt;/strong&gt; No. The tunnel forwards live traffic. Missed events come back through the provider’s retries, its manual replay tools, or your own API reconciliation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;p&gt;The stampede is only dangerous if the handler assumes each event arrives once and in order. Claim the event ID in the same transaction as your writes, guard state with versions, replay through the same path inside the sender’s window, and reconcile what the window missed. A stable tunnel URL gives retries somewhere to land, and request logs show what happened on the way back.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sources:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.stripe.com/webhooks" rel="noopener noreferrer"&gt;Stripe: Receive Stripe events in your webhook endpoint&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.stripe.com/events/manage-webhook-endpoints" rel="noopener noreferrer"&gt;Stripe: Manage webhook endpoints&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.stripe.com/api/idempotent_requests" rel="noopener noreferrer"&gt;Stripe: Idempotent requests&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.stripe.com/workbench/event-destinations" rel="noopener noreferrer"&gt;Stripe: Event destinations in Workbench&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/webhooks/testing-and-troubleshooting-webhooks/redelivering-webhooks" rel="noopener noreferrer"&gt;GitHub Docs: Redelivering webhooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/webhooks/using-webhooks/handling-failed-webhook-deliveries" rel="noopener noreferrer"&gt;GitHub Docs: Handling failed webhook deliveries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/webhooks/using-webhooks/best-practices-for-using-webhooks" rel="noopener noreferrer"&gt;GitHub Docs: Best practices for using webhooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/webhooks/testing-and-troubleshooting-webhooks/troubleshooting-webhooks" rel="noopener noreferrer"&gt;GitHub Docs: Troubleshooting webhooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://shopify.dev/docs/apps/build/webhooks/verify-deliveries" rel="noopener noreferrer"&gt;Shopify.dev: Verify webhook deliveries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://shopify.dev/docs/apps/build/webhooks/troubleshoot" rel="noopener noreferrer"&gt;Shopify.dev: Troubleshoot webhooks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://shopify.dev/docs/apps/webhooks/best-practices" rel="noopener noreferrer"&gt;Shopify.dev: Webhook best practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://shopify.dev/changelog/updates-to-webhook-retry-mechanism" rel="noopener noreferrer"&gt;Shopify.dev changelog: Updates to webhook retry mechanism&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://help.shopify.com/api/getting-started/webhooks" rel="noopener noreferrer"&gt;Shopify Help Center: Webhooks overview&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/standard-webhooks/standard-webhooks/blob/main/spec/standard-webhooks.md" rel="noopener noreferrer"&gt;Standard Webhooks specification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hookdeck.com/webhooks/slack/guide-duplicates-ordering-retries-timeouts" rel="noopener noreferrer"&gt;Hookdeck: Slack webhooks in production&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hookdeck.com/webhooks/shopify/guide-duplicates-ordering-retries-timeouts" rel="noopener noreferrer"&gt;Hookdeck: Shopify webhooks in production&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cdn.jsdelivr.net/npm/instatunnel@1.1.23/README.md" rel="noopener noreferrer"&gt;InstaTunnel README (npm)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://instatunnel.my/blog/the-reconnect-stampede-idempotency-duplicate-deliveries-and-out-of-order-events-when-your-tunnel-comes-back" rel="noopener noreferrer"&gt;https://instatunnel.my/blog/the-reconnect-stampede-idempotency-duplicate-deliveries-and-out-of-order-events-when-your-tunnel-comes-back&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>networking</category>
    </item>
    <item>
      <title>Apple Pay and Google Pay Need a Public Domain: How to Test Wallet Buttons Through a Tunnel</title>
      <dc:creator>InstaTunnel</dc:creator>
      <pubDate>Mon, 23 Nov 2026 02:34:43 +0000</pubDate>
      <link>https://dev.to/instatunnel/apple-pay-and-google-pay-need-a-public-domain-how-to-test-wallet-buttons-through-a-tunnel-2j3e</link>
      <guid>https://dev.to/instatunnel/apple-pay-and-google-pay-need-a-public-domain-how-to-test-wallet-buttons-through-a-tunnel-2j3e</guid>
      <description>&lt;p&gt;You wire up Stripe's Payment Element, load the page on &lt;code&gt;localhost:3000&lt;/code&gt;, and the card form renders. The Apple Pay and Google Pay buttons do not. There is no console error and no warning, just a missing button.&lt;/p&gt;

&lt;p&gt;That is not a bug in your code. Wallet buttons depend on a domain that Apple, Google, and Stripe can recognize from the public internet, and &lt;code&gt;localhost&lt;/code&gt; is not one. This guide explains what each party checks, how to host Apple's domain association file, how to register a domain through a tunnel, and why a stable subdomain spares you from repeating the whole routine after every restart.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Checked against Stripe and Apple documentation on November 23, 2026.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The short answer
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stripe requires domain registration&lt;/strong&gt; for Apple Pay and Google Pay when you use Elements or embedded Checkout. Payment Links and Stripe-hosted Checkout need no extra configuration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apple Pay&lt;/strong&gt; needs a domain association file reachable at &lt;code&gt;https://your-domain/.well-known/apple-developer-merchantid-domain-association&lt;/code&gt;. Apple's servers must be able to fetch it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Pay&lt;/strong&gt; needs a page served over HTTPS with a TLS domain-validated certificate, plus the same Stripe domain registration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;localhost&lt;/code&gt; and mkcert certificates cannot satisfy this.&lt;/strong&gt; Nothing outside your machine can reach them, and a certificate trusted only by your own devices is not publicly trusted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A tunnel with a stable subdomain&lt;/strong&gt; lets you register once per Stripe environment and keep testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why wallet buttons disappear on localhost
&lt;/h2&gt;

&lt;p&gt;Stripe's documentation says that to use certain payment methods with Elements or Checkout's embeddable payment form, you must register every web domain that will show the payment method. That includes top-level domains and subdomains. Apple Pay is marked as required, and Google Pay, Link, PayPal, Amazon Pay, and Klarna are on the same list.&lt;/p&gt;

&lt;p&gt;For Apple Pay, Stripe handles the merchant validation for you, including creating the Apple Merchant ID and certificate signing request, so you should not follow Apple's own merchant validation process. What remains your job is proving you control the domain. Stripe notes that Apple requests your domain association file, so the file must be publicly available to Apple's servers.&lt;/p&gt;

&lt;p&gt;That requirement is the whole problem. Your laptop's &lt;code&gt;localhost&lt;/code&gt; is invisible to Apple. A hostname you point at &lt;code&gt;127.0.0.1&lt;/code&gt; through a hosts file is invisible too. Only a public HTTPS URL that forwards to your dev server works.&lt;/p&gt;

&lt;p&gt;One more thing worth knowing before you build anything: if you use Payment Links or Stripe-hosted Checkout, Apple Pay works with no additional configuration. You only need this guide if you embed Elements or embedded Checkout on your own page.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Stripe actually requires you to register
&lt;/h2&gt;

&lt;p&gt;The rules, as Stripe documents them today:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Every domain and subdomain that shows the button.&lt;/strong&gt; &lt;code&gt;www&lt;/code&gt; counts as a subdomain, so &lt;code&gt;example.com&lt;/code&gt; and &lt;code&gt;www.example.com&lt;/code&gt; are separate registrations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Every environment separately.&lt;/strong&gt; You must register each domain and subdomain for live mode and for each sandbox.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Once per account.&lt;/strong&gt; Stripe says not to register the same domain more than once per account.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iframe domains too.&lt;/strong&gt; If your top-level domain differs from the iframe's source domain, register both. For Apple Pay on Safari 17 or later, the iframe also needs the &lt;code&gt;allow="payment"&lt;/code&gt; attribute. Before Safari 17, the iframe and top-level domains must match.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Registration is a single API call or a dashboard click:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://api.stripe.com/v1/payment_method_domains \
  -u &lt;span class="s2"&gt;"$STRIPE_SANDBOX_SECRET_KEY:"&lt;/span&gt; \
  -d &lt;span class="s2"&gt;"domain_name=my-shop-dev.instatunnel.my"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use your sandbox secret key while developing, so the registration lands in the sandbox and not in live mode. The response is a payment method domain object that reports a status per wallet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"pmd_..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"domain_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"my-shop-dev.instatunnel.my"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"enabled"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"apple_pay"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"active"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"google_pay"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"active"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a wallet's requirements were not met when you registered, that wallet is inactive on the domain and its button will not appear until it is active.&lt;/p&gt;

&lt;h2&gt;
  
  
  The domain association file, step by step
&lt;/h2&gt;

&lt;p&gt;Apple verifies domain control by looking for a file at one exact path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://&amp;lt;your-domain&amp;gt;/.well-known/apple-developer-merchantid-domain-association
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file has no extension. Stripe provides it in the Dashboard's Payment method domains page, and also publishes the current copy at &lt;code&gt;https://stripe.com/files/apple-pay/apple-developer-merchantid-domain-association&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;During registration, Stripe automatically attempts to verify the domain with Apple. If the file is not there yet, the registration still exists, but Apple Pay stays inactive. Host the file, then click Verify in the Dashboard or call the validate endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST https://api.stripe.com/v1/payment_method_domains/pmd_.../validate \
  -u &lt;span class="s2"&gt;"$STRIPE_SANDBOX_SECRET_KEY:"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Serving a dot-folder from your dev server
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;.well-known&lt;/code&gt; folder starts with a dot, and many static file servers treat dot-paths as hidden. Express's static middleware defaults to ignoring dotfiles, which means a file under &lt;code&gt;public/.well-known/&lt;/code&gt; returns 404 unless you opt in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;static&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'public'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;dotfiles&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'allow'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Put the file at &lt;code&gt;public/.well-known/apple-developer-merchantid-domain-association&lt;/code&gt;. Other frameworks that serve a &lt;code&gt;public/&lt;/code&gt; directory usually serve it as-is, but do not assume. Test it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Test the file from outside before you click Verify
&lt;/h3&gt;

&lt;p&gt;Run this against your tunnel URL, not against localhost:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -i https://my-shop-dev.instatunnel.my/.well-known/apple-developer-merchantid-domain-association
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You want a plain &lt;code&gt;200&lt;/code&gt; and the file contents. Anything else explains a failed verification:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;404.&lt;/strong&gt; Stripe's error for this case says it attempted to retrieve the file and received a 404 from your server. Check the exact path, the dotfile setting, and that the tunnel points at the right port.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A login or password wall.&lt;/strong&gt; Apple's fetcher cannot enter a password. Turn off any tunnel password protection or basic auth while you register and validate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A framework rejecting the request.&lt;/strong&gt; In one Apple developer forum thread, a server returned HTTP 406 because Apple's request arrived with an empty &lt;code&gt;Accept&lt;/code&gt; header and the app's content negotiation could not handle it. Serve the file as a static asset, ahead of any content negotiation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A blocked host.&lt;/strong&gt; Vite, Next.js, Django, and Rails dev servers can refuse unfamiliar hostnames. Add your tunnel hostname to the dev server's allowed hosts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The "outdated file" error
&lt;/h3&gt;

&lt;p&gt;If you host a stale copy, Stripe returns an error saying you have an outdated file at that path and tells you to host the current one. Stripe's support page explains that Apple uses the file's presence to verify control, and that the file has a hard-coded expiration date. If you copied the file into a repository a year ago, re-download it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Registering through a tunnel, end to end
&lt;/h2&gt;

&lt;p&gt;Here is the full sequence with a tunnel that gives you a fixed hostname. InstaTunnel's documented free-tier syntax looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install -g instatunnel
instatunnel 3000 --subdomain my-shop-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your app is now reachable at &lt;code&gt;https://my-shop-dev.instatunnel.my&lt;/code&gt;, with HTTPS provided by the tunnel.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Start the tunnel&lt;/strong&gt; and confirm the page loads in a browser from your phone or another network.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Put the association file in place&lt;/strong&gt; and run the &lt;code&gt;curl&lt;/code&gt; check above.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Register the hostname&lt;/strong&gt; in your Stripe sandbox, through the Dashboard or the API call shown earlier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Validate&lt;/strong&gt; if Apple Pay shows as inactive, then retrieve the domain object and confirm both &lt;code&gt;apple_pay.status&lt;/code&gt; and &lt;code&gt;google_pay.status&lt;/code&gt; read &lt;code&gt;active&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open the tunnel URL&lt;/strong&gt;, not &lt;code&gt;localhost&lt;/code&gt;, on your test device. Wallet buttons only appear on registered domains.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why a random tunnel URL means re-registering on every restart
&lt;/h2&gt;

&lt;p&gt;Registration belongs to a hostname. If your tunnel hands out a new random hostname each time it starts, the hostname you registered yesterday no longer points at your laptop. Every restart then costs you the same four chores: host the file, register the new domain, validate it, and update any callback URLs or allowed origins that referenced the old one.&lt;/p&gt;

&lt;p&gt;Your Stripe sandbox also collects a graveyard of dead hostnames. You can retire one by disabling it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://api.stripe.com/v1/payment_method_domains/pmd_... \
  -u &lt;span class="s2"&gt;"$STRIPE_SANDBOX_SECRET_KEY:"&lt;/span&gt; \
  -d &lt;span class="nv"&gt;enabled&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A disabled domain stops wallet payment methods from appearing in Elements or embedded Checkout, which is what you want for hostnames you no longer control. The cleaner fix is a hostname that stays the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing Apple Pay correctly
&lt;/h2&gt;

&lt;p&gt;Registration only gets the button on the page. Testing the payment has its own rules, and they surprise people.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You cannot use test cards in Apple Wallet.&lt;/strong&gt; Stripe's documentation says you must use a real credit card number with your test API keys. Stripe recognizes that you are testing and returns a successful test card token, so you can make test payments on a live card without charging it. You cannot save Stripe test cards or Apple Pay sandbox test cards to an Apple Pay wallet for this purpose.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Apple's sandbox exemption does not rescue you.&lt;/strong&gt; Apple's merchant registration documentation says Apple Pay servers do not require domain verification in the sandbox environment. That statement applies to Apple's own sandbox with sandbox tester accounts. With Stripe, the documented path is a registered domain in every environment, "in production and testing," so plan to register.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check your device and browser.&lt;/strong&gt; Stripe's wallet testing page lists the conditions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The wallet must contain at least one card.&lt;/li&gt;
&lt;li&gt;Use a compatible device and a supported version of a supported browser.&lt;/li&gt;
&lt;li&gt;Allow the browser to check for saved payment methods. In Safari, that is under Settings, Advanced, "Allow websites to check for Apple Pay and Apple card."&lt;/li&gt;
&lt;li&gt;Do not use a Chrome incognito window or Safari private window.&lt;/li&gt;
&lt;li&gt;Be in a supported Apple Pay region, on a device with biometric authentication.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;India has special rules.&lt;/strong&gt; For IP addresses in India, Stripe does not display Apple Pay in any mode. It also does not display Google Pay in live mode for those IP addresses, though you can test Google Pay in a sandbox if the Stripe account is based outside India. Stripe accounts based in India do not support Google Pay. If your button is missing and every domain check passes, test from a connection outside India before you spend a day debugging.&lt;/p&gt;

&lt;p&gt;If a wallet shows in Stripe's demo integrations but not in yours, the problem is your integration. If it is missing from the demos as well, the problem is your device or browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing Google Pay correctly
&lt;/h2&gt;

&lt;p&gt;Google Pay is simpler, with a few traps of its own.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTTPS with a TLS domain-validated certificate&lt;/strong&gt; is required on the page. A tunnel that terminates TLS with a publicly trusted certificate meets this. A self-signed or mkcert certificate does not.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Register every domain and subdomain&lt;/strong&gt; that shows the button, including &lt;code&gt;www&lt;/code&gt;, in production and testing. No association file is involved.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Send the right &lt;code&gt;Permissions-Policy&lt;/code&gt; header.&lt;/strong&gt; Some clients, including Chrome on Android, require &lt;code&gt;self&lt;/code&gt; in the payment allowlist. Stripe's example is &lt;code&gt;Permissions-Policy: payment=(self "https://js.stripe.com" "https://checkout.stripe.com")&lt;/code&gt;. Make sure your dev server sends it on pages that show the button.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add a real card to your wallet first.&lt;/strong&gt; Stripe says you must add a real card before Google Pay displays, and then you can use Google's test card suite, which accepts Stripe test cards.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where a stable subdomain fits
&lt;/h2&gt;

&lt;p&gt;Everything above gets cheaper when the hostname never changes. You host the file once, register once per sandbox, and your callback URLs and allowed origins stay valid.&lt;/p&gt;

&lt;p&gt;InstaTunnel's published documentation lists free custom subdomains, three simultaneous tunnels, and 24-hour sessions on the free tier, with HTTPS on by default and custom domains reserved for the Pro tier. Plans change, so confirm the current limits on the pricing page before you rely on them.&lt;/p&gt;

&lt;p&gt;Two habits keep this safe:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Keep the tunnel for testing.&lt;/strong&gt; Register tunnel hostnames in your sandbox only. Production should run on your real domain registered in live mode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Drop password protection while verifying.&lt;/strong&gt; Re-enable it afterward if you want, then re-run validation and confirm both wallets still read &lt;code&gt;active&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can I test Apple Pay on localhost?
&lt;/h3&gt;

&lt;p&gt;Not through Stripe's Elements or embedded Checkout. Apple's servers need to fetch your domain association file, and they cannot reach &lt;code&gt;localhost&lt;/code&gt;. Use an HTTPS tunnel.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I need to register my domain in Stripe's test mode?
&lt;/h3&gt;

&lt;p&gt;Yes. Stripe says to register every domain and subdomain separately for each environment, including each sandbox.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does Google Pay need the Apple association file?
&lt;/h3&gt;

&lt;p&gt;No. Google Pay needs HTTPS with a domain-validated certificate and domain registration in Stripe. The association file is an Apple Pay requirement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Wallet buttons feel like a front-end feature, but they are really an identity check on your domain. Apple needs to fetch a file, Google needs a trusted HTTPS page, and Stripe needs every hostname registered per environment. A tunnel gives your laptop a public address, and a stable subdomain makes that address permanent enough to register once and forget.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.stripe.com/payments/payment-methods/pmd-registration" rel="noopener noreferrer"&gt;Stripe: Register domains for payment methods&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.stripe.com/apple-pay?platform=web" rel="noopener noreferrer"&gt;Stripe: Apple Pay&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.stripe.com/google-pay?platform=web" rel="noopener noreferrer"&gt;Stripe: Google Pay&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.stripe.com/testing/wallets" rel="noopener noreferrer"&gt;Stripe: Test Apple and Google wallet rendering&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.stripe.com/api/payment_method_domains/validate" rel="noopener noreferrer"&gt;Stripe API: Validate a payment method domain&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://support.stripe.com/questions/resolve-an-outdated-apple-pay-domain-association-file" rel="noopener noreferrer"&gt;Stripe Support: Resolve an outdated Apple Pay domain association file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/documentation/applepaywebmerchantregistrationapi/preparing-merchant-domains-for-verification" rel="noopener noreferrer"&gt;Apple: Preparing merchant domains for verification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.apple.com/forums/thread/704234" rel="noopener noreferrer"&gt;Apple Developer Forums: Apple Pay Domain Verification 406 Error&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://app.unpkg.com/instatunnel@1.1.3/files/README.md" rel="noopener noreferrer"&gt;InstaTunnel README on npm (free-tier features)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://instatunnel.my/blog/apple-pay-and-google-pay-need-a-public-domain-how-to-test-wallet-buttons-through-a-tunnel" rel="noopener noreferrer"&gt;https://instatunnel.my/blog/apple-pay-and-google-pay-need-a-public-domain-how-to-test-wallet-buttons-through-a-tunnel&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>programming</category>
    </item>
    <item>
      <title>Webhooks That Wait: Latency Budgets for Synchronous Events</title>
      <dc:creator>InstaTunnel</dc:creator>
      <pubDate>Sun, 22 Nov 2026 03:51:41 +0000</pubDate>
      <link>https://dev.to/instatunnel/webhooks-that-wait-latency-budgets-for-synchronous-events-4bgb</link>
      <guid>https://dev.to/instatunnel/webhooks-that-wait-latency-budgets-for-synchronous-events-4bgb</guid>
      <description>&lt;p&gt;Most webhooks are polite. A provider sends an event, your server says “got it,” and everything else happens later. Some webhooks are not polite at all. They stop a real transaction and wait for you.&lt;/p&gt;

&lt;p&gt;If you develop those handlers on a laptop behind a tunnel, you have a new problem: the clock is already running, and the tunnel hop is a slice of it. This guide covers what the budgets are today, how to measure how much of each budget your tunnel consumes, and how to keep a local handler fast enough that you are testing your logic and not your luck.&lt;/p&gt;

&lt;h2&gt;
  
  
  The two budgets that matter right now
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Stripe Issuing: 2 seconds, and the answer is the decision
&lt;/h3&gt;

&lt;p&gt;When a card issued through Stripe Issuing is used, Stripe checks that your Issuing balance has sufficient funds, that the card is active, and that your spending controls allow the purchase. If the authorization survives those checks and you have configured a real-time authorization webhook, Stripe sends an &lt;code&gt;issuing_authorization.request&lt;/code&gt; event to your endpoint. If you do not approve or decline within 2 seconds, Stripe approves or declines the authorization for you, based on your timeout settings in the Issuing settings of the Dashboard, or on your Autopilot settings if you have configured them.&lt;/p&gt;

&lt;p&gt;Four details from the current docs shape how you design for this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The response is the decision.&lt;/strong&gt; You answer by responding directly to the webhook with a &lt;code&gt;200&lt;/code&gt; status and a JSON body. The &lt;code&gt;approved&lt;/code&gt; field is required. The &lt;code&gt;Stripe-Version&lt;/code&gt; header is also required on the response, and &lt;code&gt;application/json&lt;/code&gt; is the only content type accepted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Failure has a name.&lt;/strong&gt; When an authorization’s &lt;code&gt;request_history.reason&lt;/code&gt; is &lt;code&gt;webhook_error&lt;/code&gt; or &lt;code&gt;webhook_timeout&lt;/code&gt;, Stripe is not receiving your responses. &lt;code&gt;webhook_error&lt;/code&gt; means you responded with an invalid Stripe API version in the request headers, or Stripe could not process your response. &lt;code&gt;webhook_timeout&lt;/code&gt; covers all other failure modes. Stripe also warns against using the &lt;code&gt;approved&lt;/code&gt; flag to judge integration health, because Autopilot can approve on your behalf during an error. Its own example of something to investigate is an authorization with &lt;code&gt;approved: true&lt;/code&gt; but &lt;code&gt;request_history.reason: webhook_error&lt;/code&gt;. Subscribe to &lt;code&gt;issuing_authorization.created&lt;/code&gt; and &lt;code&gt;issuing_authorization.updated&lt;/code&gt; to watch for these, and read &lt;code&gt;request_history.reason_message&lt;/code&gt; for detailed error text.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fallbacks exist, but they are not your logic.&lt;/strong&gt; Autopilot, currently in public preview, makes decisions on your behalf from a predefined set of rules when your systems are down, do not respond, or return an invalid response. You configure it by contacting Stripe support. A separate Stripe Autopilot (also public preview) is for users with their own dedicated BIN. It helps when the card network cannot reach Stripe, and those decisions are labeled &lt;code&gt;network_fallback&lt;/code&gt;. Neither is a substitute for answering in time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Not every purchase reaches you.&lt;/strong&gt; Only authorization requests go to the synchronous endpoint. Other notifications go to your regular webhook endpoint. If your Issuing balance is too low, the authorization is denied and your webhook never sees the request. Spending-control declines happen on Stripe’s side too. If you have no real-time webhook configured, Stripe approves authorizations that pass its own checks without sending the request.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why this is suddenly everyone’s problem
&lt;/h3&gt;

&lt;p&gt;Stripe’s documentation for Issuing for agents describes giving each agent its own virtual card with per-agent spend limits, merchant category controls and custom authorization rules. It also states that once you pass a card to an agent, every purchase attempt triggers a real-time authorization request before the charge goes through. The same page says there is a 2 second default timeout to respond before Stripe falls back to the card’s default rules.&lt;/p&gt;

&lt;p&gt;Stripe’s guide for programmatic checkout adds a second path. When a seller redeems a Shared Payment Token (SPT) funded by an Issuing card, the charge runs through your existing Issuing real-time authorization path, before capture and settlement. That guide says creating a PaymentMethod from an Issuing card requires private preview access, and the SPT requests use the preview API version &lt;code&gt;2026-04-22.preview&lt;/code&gt;. Treat that flow as something to check against the current docs before you build on it.&lt;/p&gt;

&lt;p&gt;In other words, an agent buying something is now a normal source of &lt;code&gt;issuing_authorization.request&lt;/code&gt; events, and every one of them is a two-second clock.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shopify: 5 seconds, and the answer is an acknowledgement
&lt;/h3&gt;

&lt;p&gt;Shopify’s webhook troubleshooting documentation says your app must respond within five seconds, and that a &lt;code&gt;200&lt;/code&gt;-series status counts as success. Its guidance for slow handlers is to delay processing until after you have sent a response.&lt;/p&gt;

&lt;p&gt;The consequences of missing the window are spelled out too:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shopify retries failed deliveries up to eight times in a four-hour period, and the interval before each next retry increases.&lt;/li&gt;
&lt;li&gt;If failures persist, the subscription is removed. Removed subscriptions receive nothing until you create them again.&lt;/li&gt;
&lt;li&gt;The Dev Dashboard shows your 90th-percentile response time and your failed delivery rate. Failure rates above 0.5% are described as higher than average. Response times between four and five seconds are flagged as dangerously close to the limit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The difference between the two providers is the key design point:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Stripe &lt;code&gt;issuing_authorization.request&lt;/code&gt;
&lt;/th&gt;
&lt;th&gt;Shopify webhooks&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Window&lt;/td&gt;
&lt;td&gt;2 seconds&lt;/td&gt;
&lt;td&gt;5 seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What you return&lt;/td&gt;
&lt;td&gt;The decision itself&lt;/td&gt;
&lt;td&gt;A 2xx acknowledgement&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Work after responding&lt;/td&gt;
&lt;td&gt;Not possible for the decision&lt;/td&gt;
&lt;td&gt;Expected, and recommended&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;On a miss&lt;/td&gt;
&lt;td&gt;Your timeout settings (or Autopilot) decide&lt;/td&gt;
&lt;td&gt;Retries up to 8 times, then subscription removal&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;With Shopify you can cheat the clock by acknowledging fast and working later. With Stripe Issuing you cannot, because the work you would defer is the thing Stripe is waiting for.&lt;/p&gt;

&lt;h2&gt;
  
  
  Anatomy of a 2,000 ms budget
&lt;/h2&gt;

&lt;p&gt;Treat the window as a budget you spend, not a limit you hope to stay under. For a synchronous webhook, the time between Stripe sending the request and receiving your response breaks down roughly like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stripe to the tunnel edge (internet transit, TLS)&lt;/li&gt;
&lt;li&gt;Tunnel edge to the tunnel agent on your machine (the tunnel itself)&lt;/li&gt;
&lt;li&gt;Agent to your local server (loopback, effectively free)&lt;/li&gt;
&lt;li&gt;Your handler (parsing, verification, decision logic, any I/O)&lt;/li&gt;
&lt;li&gt;The same path back out&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is an illustrative allocation. These are planning numbers, not measurements of any service:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Segment&lt;/th&gt;
&lt;th&gt;Planning allowance&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Inbound network and TLS&lt;/td&gt;
&lt;td&gt;100–300 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tunnel hop, both directions&lt;/td&gt;
&lt;td&gt;50–200 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Signature verification and parsing&lt;/td&gt;
&lt;td&gt;under 10 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Decision logic&lt;/td&gt;
&lt;td&gt;under 100 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Safety margin&lt;/td&gt;
&lt;td&gt;800 ms or more&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Notice what the table implies. If your handler does one cold database query or one outbound API call, you can burn the margin without noticing, and the tunnel is not the culprit. The only way to know is to measure.&lt;/p&gt;

&lt;p&gt;A useful rule is to set an internal deadline well under the provider’s window, for example 800 to 1,000 ms for Stripe, and make your handler return its best answer by then, whatever state its dependencies are in. If you decide on your own timeout, you choose the fallback decision. If Stripe’s clock decides, your Dashboard settings (or Autopilot) choose it for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measuring the tunnel hop
&lt;/h2&gt;

&lt;p&gt;You cannot subtract what you have not measured. Use three measurements and compare them.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Time the handler itself
&lt;/h3&gt;

&lt;p&gt;Instrument your own code. This is the number the tunnel cannot affect. Here is a minimal Node and Express example that reports its own duration with the standard &lt;code&gt;Server-Timing&lt;/code&gt; header:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"express"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/stripe/issuing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hrtime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;bigint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// 1. Verify the Stripe-Signature header against req.body (the raw bytes),&lt;/span&gt;
  &lt;span class="c1"&gt;//    for example with stripe.webhooks.constructEvent().&lt;/span&gt;
  &lt;span class="c1"&gt;// 2. Run your decision logic.&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;decision&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;approved&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;ms&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hrtime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;bigint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;1e6&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"issuing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;handler_ms&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ms&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Stripe-Version"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"2025-03-31.basil"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// use a supported version, see Stripe's API versioning docs&lt;/span&gt;
  &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Server-Timing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sb"&gt;`handler;dur=${ms.toFixed(1)}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;decision&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;Stripe-Version&lt;/code&gt; value above is the one used in Stripe’s own example. Check Stripe’s API versioning page for supported values, because an invalid version header is a documented cause of &lt;code&gt;webhook_error&lt;/code&gt;. Stripe’s docs also say to verify webhook signatures and allowlist Stripe’s IP addresses so you only act on genuine Stripe events.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Time the request end to end with curl
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;curl&lt;/code&gt; can break a request into stages. Each value is a cumulative timestamp from the start of the request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s -o /dev/null -X POST &lt;span class="s2"&gt;"https://YOUR-SUBDOMAIN.example-tunnel.dev/stripe/issuing"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; -d &lt;span class="s1"&gt;'{"test":true}'&lt;/span&gt; \
  -w &lt;span class="s1"&gt;'dns=%{time_namelookup} connect=%{time_connect} tls=%{time_appconnect} first_byte=%{time_starttransfer} total=%{time_total}\n'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the same command against &lt;code&gt;http://localhost:3000/stripe/issuing&lt;/code&gt;. The gap between the two &lt;code&gt;total&lt;/code&gt; values, taken over many runs, is your tunnel overhead as seen from your own position. For a handler that verifies signatures, an unsigned test request will be rejected early. Either add a test bypass or send a correctly signed payload.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Compare percentiles, not averages
&lt;/h3&gt;

&lt;p&gt;A budget is broken by the slow tail, not the median. Run a couple of hundred requests each way and compare p50, p95 and p99:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://YOUR-SUBDOMAIN.example-tunnel.dev/stripe/issuing"&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; i &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;$(&lt;/span&gt;seq 1 200&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  curl -s -o /dev/null -w &lt;span class="s1"&gt;'%{time_total}\n'&lt;/span&gt; -X POST &lt;span class="s2"&gt;"$URL"&lt;/span&gt; \
    -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; -d &lt;span class="s1"&gt;'{}'&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; sort -n &lt;span class="o"&gt;|&lt;/span&gt; awk &lt;span class="s1"&gt;'{a[NR]=$1} END {print "p50="a[int(NR*0.50)], "p95="a[int(NR*0.95)], "p99="a[int(NR*0.99)]}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Know what your measurement leaves out
&lt;/h3&gt;

&lt;p&gt;Be honest about the limits of laptop-side measurement. When you call your own tunnel URL from the same machine, the request leaves your network, reaches the edge, and comes back down the tunnel to you. That hairpin path is not the path Stripe’s servers take, so it can overstate or understate the real inbound latency. Two ways to tighten it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run the &lt;code&gt;curl&lt;/code&gt; loop from a small cloud VM in a region near the provider’s likely origin, so the inbound leg resembles reality.&lt;/li&gt;
&lt;li&gt;Log a receive timestamp in your handler and compare it with the event’s own creation time. Stripe’s event timestamps are in whole seconds and your clock may be skewed, so use this only to spot gross delays, not to measure milliseconds.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Using request logs to see what actually happened
&lt;/h2&gt;

&lt;p&gt;Measurements from a loop tell you what is possible. Request logs tell you what happened when the real provider called. When a Stripe authorization comes back as &lt;code&gt;webhook_timeout&lt;/code&gt;, you want to answer one question: did the request reach my machine at all, and what did my handler do with it?&lt;/p&gt;

&lt;p&gt;InstaTunnel’s CLI documents an &lt;code&gt;--logs&lt;/code&gt; flag that polls live request logs, and states that request logs require the Pro or Business plan. That gives you a record of requests that crossed the tunnel, which you can set against your handler’s own logs and against Stripe’s &lt;code&gt;request_history&lt;/code&gt; for the same authorization. A practical workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Find the authorization in Stripe and note its &lt;code&gt;request_history.reason&lt;/code&gt; and &lt;code&gt;reason_message&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Find the matching request in the tunnel’s request logs. If it is missing, the problem is upstream of your laptop. If it is present, the problem is in or after your handler.&lt;/li&gt;
&lt;li&gt;Match it to your handler’s structured log line and its &lt;code&gt;handler_ms&lt;/code&gt; value.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Keep your handler’s own duration log as the source of truth either way, since a tunnel’s log view is a record of traffic and not a substitute for timing your own code.&lt;/p&gt;

&lt;p&gt;On the Shopify side, the Dev Dashboard’s Logs page lists individual deliveries from the past 7 days, filterable by topic, status and shop. Shopify notes that this view is not real time and data can lag by up to several minutes, so do not conclude a delivery is missing right after it fails.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping a laptop handler fast
&lt;/h2&gt;

&lt;p&gt;A laptop is a fine place to build a synchronous handler and an unforgiving place to run one if you ignore its habits. These are the common ways local handlers lose their budget.&lt;/p&gt;

&lt;h3&gt;
  
  
  Eliminate cold paths
&lt;/h3&gt;

&lt;p&gt;The first request after idle time is often the slowest. Connection pools are empty, caches are cold, and a language runtime may still be warming up. Before a test, send a few throwaway requests. During the test, keep database and HTTP clients alive and reuse connections instead of opening a new one per request.&lt;/p&gt;

&lt;h3&gt;
  
  
  Decide from memory
&lt;/h3&gt;

&lt;p&gt;For Stripe Issuing, design the decision to need no network round trip at all. Load your spend rules, merchant category allowlists and per-card limits into memory at startup and refresh them on a timer. The authorization payload already carries the merchant details and the metadata you attached to the card, and Stripe’s agent docs suggest common checks such as matching the business to the agent’s task, confirming the amount against the expected budget, and flagging unusual transaction velocity. All of these can run against in-process data. A decision that reads a few in-memory maps takes microseconds. A decision that waits on a remote database is a lottery ticket against the clock.&lt;/p&gt;

&lt;p&gt;If your agent platform wants a model to judge a purchase, do that analysis ahead of time and cache the verdict, or have the model set the card’s controls up front. Stripe’s docs say spend limits and merchant category controls are set at card creation and can be updated at any time. A model call inside the two-second window is the most expensive place to put judgment you could have encoded earlier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Put every outbound call behind a deadline
&lt;/h3&gt;

&lt;p&gt;Wrap anything that can block in a timeout, and make the fallback decision explicit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;controller&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AbortController&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;timer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;risk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;RISK_URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;signal&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c1"&gt;// use the result&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// timed out: apply your documented default policy&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;clearTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;timer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Choose the default deliberately. Declining protects spend but frustrates a legitimate purchase. Approving keeps agents flowing but widens exposure. Whatever you choose, write it down, because Stripe will otherwise apply whatever your timeout settings say.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tame the machine
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Power and sleep.&lt;/strong&gt; A laptop on battery may throttle the CPU, and a sleeping laptop answers nothing. Stay on power and keep the machine awake while testing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wi-Fi jitter.&lt;/strong&gt; Wireless links add variable delay that the median hides and the p99 reveals. Test over Ethernet at least once to see how much is your radio.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background load.&lt;/strong&gt; A local build, a container pulling images, or a sync client can steal CPU exactly when a request lands. Check what else is running before you trust a bad number.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Debug mode.&lt;/strong&gt; A debugger paused on a breakpoint will blow any budget. Use logging, not breakpoints, for latency tests.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Acknowledge first when the provider lets you
&lt;/h3&gt;

&lt;p&gt;For Shopify, return &lt;code&gt;200&lt;/code&gt; the moment the payload is received and verified, then queue the real work. Persist the raw event to a local queue or file before you respond, so a crash after the acknowledgement does not lose data. Because retries mean the same event can arrive more than once, make downstream processing idempotent. Shopify’s “Verify deliveries” page covers HMAC verification and handling duplicate deliveries. If your app goes offline for a long stretch, Shopify’s recovery advice is to re-subscribe where needed and re-import the missing data.&lt;/p&gt;

&lt;h2&gt;
  
  
  A pre-flight checklist
&lt;/h2&gt;

&lt;p&gt;Run through this before you register a tunnel URL with a provider for synchronous events:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Know the window: 2 seconds for Stripe Issuing real-time authorizations, 5 seconds for Shopify webhooks.&lt;/li&gt;
&lt;li&gt;Set an internal deadline well inside the window.&lt;/li&gt;
&lt;li&gt;Measure handler time, then total time through the tunnel, at p50, p95 and p99.&lt;/li&gt;
&lt;li&gt;Warm the handler and reuse connections.&lt;/li&gt;
&lt;li&gt;Keep decision data in memory.&lt;/li&gt;
&lt;li&gt;Give every outbound call a hard timeout and an explicit fallback.&lt;/li&gt;
&lt;li&gt;For Stripe, return the decision directly with a valid &lt;code&gt;Stripe-Version&lt;/code&gt; header, verify signatures, and watch &lt;code&gt;request_history.reason&lt;/code&gt; for &lt;code&gt;webhook_error&lt;/code&gt; and &lt;code&gt;webhook_timeout&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;For Shopify, acknowledge first, queue the work, and watch the Dev Dashboard’s p90 response time and failure rate.&lt;/li&gt;
&lt;li&gt;Keep the tunnel URL stable between runs so you register it once.&lt;/li&gt;
&lt;li&gt;Review the request logs after every miss.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Testing without waiting for a real card
&lt;/h2&gt;

&lt;p&gt;You do not need a physical card swipe to exercise the path. Stripe provides Issuing test helpers, including an Authorization Create API that simulates a new authorization on an Issuing card. There are matching helpers for incremental authorizations and reversals. Configure your real-time authorization endpoint in your Issuing settings with your tunnel URL, create authorizations through the helper, and watch what arrives. Run it in batches so you see tail behavior and not one lucky request.&lt;/p&gt;

&lt;p&gt;Stripe’s docs also describe a lighter local loop. &lt;code&gt;stripe listen --forward-to localhost:4242/webhook&lt;/code&gt; forwards events to your server, and &lt;code&gt;stripe trigger issuing_authorization.request&lt;/code&gt; fires a test event from the CLI. That is handy for checking your logic. For measuring tunnel latency, send traffic through the tunnel itself.&lt;/p&gt;

&lt;p&gt;For Shopify, the Dev Dashboard lets you trigger a delivery by updating your dev store, for example by creating a product to fire &lt;code&gt;products/create&lt;/code&gt;, and then read the delivery’s response time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The takeaway
&lt;/h2&gt;

&lt;p&gt;Synchronous webhooks turn latency into a correctness requirement. Stripe gives you 2 seconds to produce a decision. Shopify gives you 5 to produce an acknowledgement. Neither window is generous once you add the internet, a tunnel, and a laptop that is also running your editor.&lt;/p&gt;

&lt;p&gt;The good news is that the budget is easy to manage once you stop guessing. Measure your handler, measure the full path, look at the tail, keep decisions in memory, put deadlines on every outbound call, and read the request logs when something misses. Do that, and the tunnel becomes one small, known line item instead of the suspect in every timeout.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Stripe: &lt;a href="https://docs.stripe.com/issuing/controls/real-time-authorizations" rel="noopener noreferrer"&gt;Issuing real-time authorizations&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Stripe: &lt;a href="https://docs.stripe.com/issuing/purchases/authorizations" rel="noopener noreferrer"&gt;Issuing authorizations&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Stripe: &lt;a href="https://docs.stripe.com/issuing/agents" rel="noopener noreferrer"&gt;Issuing for agents&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Stripe: &lt;a href="https://docs.stripe.com/issuing/agents/programmatic-checkout" rel="noopener noreferrer"&gt;Pay with a Shared Payment Token from an Issuing card&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Shopify: &lt;a href="https://shopify.dev/docs/apps/build/webhooks/troubleshoot" rel="noopener noreferrer"&gt;Troubleshoot webhooks&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;InstaTunnel: &lt;a href="https://cdn.jsdelivr.net/npm/instatunnel@1.1.23/README.md" rel="noopener noreferrer"&gt;CLI README&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://instatunnel.my/blog/webhooks-that-wait-latency-budgets-for-synchronous-events" rel="noopener noreferrer"&gt;https://instatunnel.my/blog/webhooks-that-wait-latency-budgets-for-synchronous-events&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>networking</category>
    </item>
    <item>
      <title>Your CA Got Distrusted Overnight: Auditing Trust Stores for Tunnel Agents and Custom Domains</title>
      <dc:creator>InstaTunnel</dc:creator>
      <pubDate>Sat, 21 Nov 2026 01:43:12 +0000</pubDate>
      <link>https://dev.to/instatunnel/your-ca-got-distrusted-overnight-auditing-trust-stores-for-tunnel-agents-and-custom-domains-5b5j</link>
      <guid>https://dev.to/instatunnel/your-ca-got-distrusted-overnight-auditing-trust-stores-for-tunnel-agents-and-custom-domains-5b5j</guid>
      <description>&lt;p&gt;Most developers think certificate trust is something the browser handles. In October 2026, a certificate authority incident showed otherwise. Within days of the report, browsers had blocked the compromised keys, Chrome and Mozilla had removed the root above them, and Go, Node.js, Python’s certifi and the major Linux distributions were shipping patches. Clients that missed the patches kept trusting the compromised keys.&lt;/p&gt;

&lt;p&gt;If you run a custom domain in front of a tunnel, or receive webhooks from third parties, you can audit this in an afternoon. This guide shows how to see which chain your domain presents, test it from outside, and check the trust stores in your own tooling. It also covers what is still changing as of November 21, 2026.&lt;/p&gt;

&lt;h2&gt;
  
  
  What happened to the eMudhra intermediates
&lt;/h2&gt;

&lt;p&gt;On Saturday, October 17, 2026, at 18:05 UTC, a researcher reported to the Chrome Root Program that the private keys of eight eMudhra subordinate CA certificates were recoverable. Six of the eight issue TLS certificates and two issue code-signing certificates. The keys were generated with almost no entropy, and anyone could compute them from the public certificates.&lt;/p&gt;

&lt;p&gt;eMudhra’s later incident report traces the cause to a key ceremony on April 30, 2025. After the keys were generated correctly in a hardware module, a custom Python script read each private key back into host memory. For the ECDSA keys, one line of that script truncated the value to its leading byte, so the re-created key was a number below 256.&lt;/p&gt;

&lt;p&gt;The response came fast:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chrome:&lt;/strong&gt; at 19:45 UTC the same day, Chrome landed a CRLSet update blocking the SPKI hashes of the six TLS intermediates. Because the block is by key, it also covers the Sectigo cross-certificates that share those keys.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mozilla:&lt;/strong&gt; received the report at 20:06 UTC and completed its OneCRL block later that evening. It removed emSign ECC Root CA - G3 from NSS in version 3.131.1 on October 20.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apple and Microsoft:&lt;/strong&gt; both blocked the certificates within days. Microsoft also removed the AAA Certificate Services cross-signing root from its root store on October 25.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google:&lt;/strong&gt; announced on October 20 that it had removed emSign ECC Root CA - G3 from the Chrome Root Store, for consumers that ignore CRLSets. The removal was scheduled to reach devices on the morning of October 27, Pacific time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;eMudhra:&lt;/strong&gt; revoked all eight intermediates on October 18, and Sectigo revoked the cross-certificates on October 19. On October 22, eMudhra’s board announced it would exit the global SSL/TLS certificate business.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each compromised key had two certificates: one issued by eMudhra’s own root and one cross-signed by Sectigo’s AAA Certificate Services root. Any bundle that still carries either root can validate chains built on the weak keys.&lt;/p&gt;

&lt;p&gt;Browsers were never practically exposed, because Chrome-style CT enforcement would have caught forged certificates. No TLS certificates chaining to the six intermediates had been logged to Certificate Transparency before Chrome’s block. The risk sits with clients that skip both revocation and CT checks, such as command-line tools, language runtimes, containers and embedded devices. The researcher’s disclosure site notes that many clients outside the browser ecosystem don’t enforce CT. Certificates for google.com signed with the weak keys were publicly logged within days, according to ctlogs.dev’s index, so exploiting a vulnerable client needs no secret.&lt;/p&gt;

&lt;p&gt;Legitimate eMudhra customers were collateral damage. The compromised CAs never issued certificates of their own, but certificates issued through other intermediates under the same G3 hierarchy lost their root. eMudhra told Mozilla on October 20 that about 30,000 certificates needed to move, about 97 percent of them issued via ACME.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why “which clients trust it?” has no single answer
&lt;/h2&gt;

&lt;p&gt;A request through a tunnel can involve a CLI, a runtime, a container image and a third-party sender. Each has its own idea of which roots are valid. These are the main fixed versions:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Client&lt;/th&gt;
&lt;th&gt;Where its trust comes from&lt;/th&gt;
&lt;th&gt;Fixed in&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Go programs&lt;/td&gt;
&lt;td&gt;OS store, plus a verification filter compiled into &lt;code&gt;crypto/x509&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Go 1.27.3 and 1.26.10, then rebuild. Go 1.25 and older get no fix&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Node.js&lt;/td&gt;
&lt;td&gt;Its own bundled root list&lt;/td&gt;
&lt;td&gt;22.23.4, 24.22.1 and 26.12.1 (released October 21)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Python requests&lt;/td&gt;
&lt;td&gt;certifi bundle&lt;/td&gt;
&lt;td&gt;certifi 2026.10.19&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pip&lt;/td&gt;
&lt;td&gt;Its own vendored certifi&lt;/td&gt;
&lt;td&gt;pip 26.2.2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CPython&lt;/td&gt;
&lt;td&gt;Its bundled pip, plus the OS store for &lt;code&gt;ssl&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;3.15.2, 3.14.10, 3.13.18, 3.12.16, 3.11.18&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alpine containers&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ca-certificates&lt;/code&gt; package&lt;/td&gt;
&lt;td&gt;20261020-r0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;macOS command-line tools&lt;/td&gt;
&lt;td&gt;&lt;code&gt;/etc/ssl/cert.pem&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;macOS 27.2.1, 26.7.3, 15.8.3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tailscale&lt;/td&gt;
&lt;td&gt;Go toolchain&lt;/td&gt;
&lt;td&gt;1.104.2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Node.js covered only the 26.x, 24.x and 22.x lines. The project’s own advisory notes that end-of-life versions are always affected by security releases, so check your runtime matrix.&lt;/p&gt;

&lt;p&gt;Go’s change is a filter on eight key hashes that runs whenever a Go program verifies a chain. It also applies when a program supplies its own roots. A Go binary keeps its old behavior until it is rebuilt with a patched toolchain.&lt;/p&gt;

&lt;p&gt;The macOS gap is worth knowing. Apple blocked the certificates in Safari, Mail and apps using its frameworks in October. The command-line tools that ship with macOS (curl, git, python3, ruby, perl, openssl) verify against &lt;code&gt;/etc/ssl/cert.pem&lt;/code&gt; and don’t consult Apple’s block. That gap was only closed by the November updates.&lt;/p&gt;

&lt;p&gt;The result is a split-brain failure mode. A patched client rejects a chain anchored at a removed root while an unpatched one accepts it. Your domain can look healthy in your browser, fail in a freshly built container, and succeed from a provider with an old bundle.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Check which chain your custom domain presents
&lt;/h2&gt;

&lt;p&gt;Start with the chain your server actually sends, not the one your certificate dashboard claims. Use SNI, because a tunnel edge often serves many hostnames from one address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl s_client -connect app.example.com:443 \
  -servername app.example.com -showcerts &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/dev/null 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null \
  &lt;span class="o"&gt;|&lt;/span&gt; grep -E &lt;span class="s2"&gt;"^ *[0-9]+ s:|^ *i:"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read the output from top to bottom. Line &lt;code&gt;0&lt;/code&gt; is your leaf certificate, and each &lt;code&gt;i:&lt;/code&gt; line names its issuer. To flag anything eMudhra-related automatically, append &lt;code&gt;| grep -iE "emsign|emudhra|EM (DV|OV|EV) TLS"&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You are looking for these names anywhere in the chain:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;emSign ECC Root CA - G3&lt;/code&gt; and &lt;code&gt;emSign Root TLS CA - G3&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;emSign Root CA - G1&lt;/code&gt; and &lt;code&gt;emSign Root TLS CA - G1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;the compromised issuing CAs: &lt;code&gt;EM DV TLS CA - G3B&lt;/code&gt; and &lt;code&gt;G3C&lt;/code&gt;, &lt;code&gt;EM OV TLS CA - G3B&lt;/code&gt; and &lt;code&gt;G3C&lt;/code&gt;, &lt;code&gt;EM EV TLS CA - G3B&lt;/code&gt; and &lt;code&gt;G3C&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Seeing &lt;code&gt;AAA Certificate Services&lt;/code&gt; is not by itself a problem. It is a long-standing Sectigo root that many legitimate chains still use. It matters only when a chain runs through an eMudhra intermediate, or when you are auditing a trust store for the cross-signed copies of the weak keys.&lt;/p&gt;

&lt;p&gt;Servers usually omit the root, so treat the last &lt;code&gt;i:&lt;/code&gt; line as the root the chain claims to anchor to. Swapping in a different intermediate does not help if the hierarchy above it is still in question. Run the check from a throwaway cloud shell too, to see the chain as a stranger would.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Test from the outside, through the clients that matter
&lt;/h2&gt;

&lt;p&gt;A browser tab proves very little here. The failure you care about usually happens in a runtime or a sender, so test from the same kinds of clients your traffic comes from.&lt;/p&gt;

&lt;p&gt;The researcher who disclosed the incident runs test hosts that serve certificates signed with the compromised keys. A correctly updated client should reject them, so a successful connection is the bad result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# curl: a certificate error is the result you want&lt;/span&gt;
curl -sS https://dv-g3b-emudhra.we-have-a-problem.com/ -o /dev/null \
  &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"STILL TRUSTED"&lt;/span&gt;

&lt;span class="c"&gt;# The Sectigo cross-signed path (chains to AAA Certificate Services)&lt;/span&gt;
curl -sS https://dv-g3b-aaa-emudhra.we-have-a-problem.com/ -o /dev/null \
  &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"STILL TRUSTED (AAA path)"&lt;/span&gt;

&lt;span class="c"&gt;# Python requests (uses certifi)&lt;/span&gt;
python -c &lt;span class="s2"&gt;"import requests; requests.get('https://dv-g3b-emudhra.we-have-a-problem.com/'); print('STILL TRUSTED')"&lt;/span&gt;

&lt;span class="c"&gt;# Node.js (uses its own roots)&lt;/span&gt;
node -e &lt;span class="s2"&gt;"require('https').get('https://dv-g3b-emudhra.we-have-a-problem.com/', () =&amp;gt; console.log('STILL TRUSTED')).on('error', e =&amp;gt; console.log('rejected:', e.code))"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The site also offers &lt;code&gt;dv-g3b-noct-emudhra.we-have-a-problem.com&lt;/code&gt; and &lt;code&gt;dv-g3b-aaa-noct-emudhra.we-have-a-problem.com&lt;/code&gt;. Their leaf certificates were never logged to CT. A successful connection there means the client both trusts the weak keys and doesn’t enforce CT, which is the combination an attacker could use without anyone noticing.&lt;/p&gt;

&lt;p&gt;Run each check inside the environments that matter: your CI image, the server that handles callbacks, a developer laptop. Git has its own check, &lt;code&gt;git ls-remote https://git-emudhra.we-have-a-problem.com/check.git&lt;/code&gt;. A certificate error means git is protected. Two cautions apply:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Apple’s guidance notes that apps and tools carrying their own root lists don’t use Apple’s blocks, so check those separately.&lt;/li&gt;
&lt;li&gt;Never silence a rejection by disabling verification.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 3: Audit the trust stores in your own tooling
&lt;/h2&gt;

&lt;p&gt;Next, look for the roots themselves. PEM bundles rarely carry readable names, so match on SHA-256 fingerprint:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Root&lt;/th&gt;
&lt;th&gt;SHA-256 fingerprint&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;emSign ECC Root CA - G3&lt;/td&gt;
&lt;td&gt;&lt;code&gt;86a1ecba089c4a8d3bbe2734c612ba341d813e043cf9e8a862cd5c57a36bbe6b&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;emSign Root CA - G1&lt;/td&gt;
&lt;td&gt;&lt;code&gt;40f6af0346a99aa1cd1d555a4e9cce62c7f9634603ee406615833dc8c8d00367&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AAA Certificate Services&lt;/td&gt;
&lt;td&gt;&lt;code&gt;d7a7a0fb5d7e2731d771e9484ebcdef71d5f0c3e0a2948782bc83ee0ea699ef4&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Split a bundle and compare each certificate's fingerprint&lt;/span&gt;
&lt;span class="nv"&gt;bundle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/etc/ssl/certs/ca-certificates.crt   &lt;span class="c"&gt;# or your certifi path&lt;/span&gt;
&lt;span class="nv"&gt;work&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;mktemp -d&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="s2"&gt;"$work"&lt;/span&gt;
awk &lt;span class="s1"&gt;'/BEGIN CERT/{n++} {print &amp;gt; sprintf("cert-%03d.pem", n)}'&lt;/span&gt; &lt;span class="s2"&gt;"$bundle"&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; f &lt;span class="k"&gt;in&lt;/span&gt; cert-*.pem&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="nv"&gt;fp&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;openssl x509 -in &lt;span class="s2"&gt;"$f"&lt;/span&gt; -noout -fingerprint -sha256 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null \
       &lt;span class="o"&gt;|&lt;/span&gt; cut -d= -f2 &lt;span class="o"&gt;|&lt;/span&gt; tr -d &lt;span class="s1"&gt;':'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; tr &lt;span class="s1"&gt;'A-F'&lt;/span&gt; &lt;span class="s1"&gt;'a-f'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"$fp"&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
    86a1ecba089c4a8d3bbe2734c612ba341d813e043cf9e8a862cd5c57a36bbe6b&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"FOUND emSign ECC Root CA - G3 in $bundle"&lt;/span&gt; &lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    40f6af0346a99aa1cd1d555a4e9cce62c7f9634603ee406615833dc8c8d00367&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"FOUND emSign Root CA - G1 in $bundle"&lt;/span&gt; &lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    d7a7a0fb5d7e2731d771e9484ebcdef71d5f0c3e0a2948782bc83ee0ea699ef4&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"FOUND AAA Certificate Services in $bundle"&lt;/span&gt; &lt;span class="o"&gt;;&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;esac&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finding G3 means the bundle is stale. Finding AAA means chains built on the cross-signed weak keys could still validate there. Finding G1 is expected in some bundles for now, but its removal is underway (see below).&lt;/p&gt;

&lt;p&gt;Repeat the audit for every bundle you own:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;System store&lt;/strong&gt; on hosts and base images (&lt;code&gt;/etc/ssl/certs&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Language bundles&lt;/strong&gt;, such as &lt;code&gt;python -c "import certifi; print(certifi.where())"&lt;/code&gt;, including copies vendored inside virtualenvs or pip.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runtime stores:&lt;/strong&gt; Node.js version, JDK &lt;code&gt;cacerts&lt;/code&gt;, Electron, Deno and Bun builds. On Debian and Ubuntu, the Java keystore is not refreshed when the system store changes, because of a long-standing &lt;code&gt;ca-certificates-java&lt;/code&gt; bug. Recreate it with &lt;code&gt;rm -f /etc/ssl/certs/java/cacerts &amp;amp;&amp;amp; update-ca-certificates --fresh&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compiled binaries:&lt;/strong&gt; a Go service keeps its old trust behavior until rebuilt with a patched toolchain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hand-maintained bundles:&lt;/strong&gt; a &lt;code&gt;connect_cas&lt;/code&gt; file, a mounted &lt;code&gt;ca.pem&lt;/code&gt;, a proxy bundle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agents with their own bundle:&lt;/strong&gt; for example, Fleet’s agent keeps a bundle written at install time, so enrolled hosts still need that file cleaned.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After upgrading, restart long-lived processes so they pick up the new trust data, and rebuild images rather than patching running containers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tunnel agents: pinned or host-trusted?
&lt;/h2&gt;

&lt;p&gt;ngrok published a useful model on October 21. Its default agent pins ngrok’s own root CA, so a forged certificate chained to a compromised public root is rejected whatever the host trusts. Agent updates are protected separately by a signature the agent verifies independently of TLS.&lt;/p&gt;

&lt;p&gt;Some features talk to other endpoints and use the host store like any HTTP client:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ngrok api&lt;/code&gt;, which sends your API key&lt;/li&gt;
&lt;li&gt;&lt;code&gt;--traffic-policy-url&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;an HTTPS &lt;code&gt;proxy_url&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;connect_cas: host&lt;/code&gt;, which skips pinning and is common behind TLS-inspecting enterprise proxies&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For those, ngrok advised updating the OS bundle or upgrading to agent v3.39.12, which is built on a patched Go release that blocklists the affected roots regardless of the host store. Agent v2 is past end-of-life and gets no such fixes. Checking is simple: run &lt;code&gt;ngrok config check&lt;/code&gt; to find your config, look for &lt;code&gt;connect_cas&lt;/code&gt; or &lt;code&gt;root_cas&lt;/code&gt;, and search your scripts for the other settings.&lt;/p&gt;

&lt;p&gt;Ask the same questions of any tunnel CLI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does it &lt;strong&gt;pin&lt;/strong&gt; the provider’s CA or &lt;strong&gt;trust the host store&lt;/strong&gt; for its control connection?&lt;/li&gt;
&lt;li&gt;Which secondary calls (API, config fetch, update check) fall back to the host store?&lt;/li&gt;
&lt;li&gt;Is it a Go binary, and which toolchain built it?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A pinning agent is less sensitive to a stale bundle on old appliances and long-lived dev boxes. A host-trusting one inherits whatever your machine believes. Get the answer from the vendor’s documentation rather than guessing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Webhook senders: the clients you don’t control
&lt;/h2&gt;

&lt;p&gt;When a provider calls your webhook URL, it is the client and your custom domain is the server. You cannot patch or even see the sender’s bundle. If your certificate chained to a removed root, a sender with an up-to-date store will reject it while one with an older bundle may keep accepting it, so failures arrive unevenly, provider by provider. Each sender’s retry logic then decides whether you see a loud outage or a quiet pile of dropped events.&lt;/p&gt;

&lt;p&gt;Treat the chain as part of your webhook contract:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Serve a chain from a hierarchy that every major root program trusts.&lt;/li&gt;
&lt;li&gt;After any change, send a real test event from each provider that supports one.&lt;/li&gt;
&lt;li&gt;Watch provider delivery logs for TLS errors, which often look different from HTTP errors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your tunnel provider issues the certificate for your custom domain, ask which CA issues it and how a CA change would be handled. If you bring your own, the chain is yours to verify.&lt;/p&gt;

&lt;h2&gt;
  
  
  Replacing a chain without downtime
&lt;/h2&gt;

&lt;p&gt;When the chain has to change, order matters:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Add the new CA to your CAA record first.&lt;/strong&gt; A stale CAA record can block an emergency reissue.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get the replacement certificate with its full chain&lt;/strong&gt; from a hierarchy that is in the Chrome Root Store, which is Google’s stated guidance. Also confirm the other root programs you care about.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Install it and re-run Step 1&lt;/strong&gt; to confirm the presented chain no longer names the affected roots or intermediates.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Re-run Step 2&lt;/strong&gt; from your runtimes and send test webhooks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Only then retire the old certificate.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;ACME automation makes this a short job. That is the practical lesson of eMudhra’s 97 percent figure: most affected certificates could be replaced mechanically.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is still moving
&lt;/h2&gt;

&lt;p&gt;The story did not end on October 27, and the G1 root is where it is still unfolding. On November 4, Google said that TLS certificates chaining to eMudhra’s remaining emSign Root CA - G1 will no longer be trusted by default in Chrome 153 and higher if their earliest Signed Certificate Timestamp is dated after November 16, 2026, 23:59:59 UTC. Certificates logged on or before that moment are unaffected for now. The change was timed to coincide with Chrome 158 Stable on November 17, and Google said the date and approach could shift. Mozilla set the same cutoff in NSS.&lt;/p&gt;

&lt;p&gt;Other vendors are going further:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Microsoft&lt;/strong&gt; announced it would remove the remaining 10 eMudhra roots, including G1, from Windows, Edge and WebView2 on November 16.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apple:&lt;/strong&gt; according to eMudhra, Apple removes the G1 roots on November 30, after which certificates under them stop working on Apple devices whatever their issue date.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;eMudhra:&lt;/strong&gt; on November 7 it revoked eight more RSA intermediates from the same key ceremony. Their keys aren’t weak, but the keys left the hardware module during the ceremony. It planned to stop all issuance from the G1 hierarchy on November 16.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So a certificate issued under G1 after the cutoff fails in Chrome by default, and a quick replacement from eMudhra’s old hierarchy is not a safe choice. Re-run Step 1 on any domain you migrated in a hurry in October. If it chains to G1, check the earliest SCT date and move it to a different hierarchy before Apple’s November 30 removal. To read the SCT dates on your leaf certificate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openssl s_client -connect app.example.com:443 -servername app.example.com \
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;/dev/null 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;|&lt;/span&gt; openssl x509 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; leaf.pem
openssl x509 -in leaf.pem -noout -text &lt;span class="o"&gt;|&lt;/span&gt; grep -A2 &lt;span class="s2"&gt;"Timestamp"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A short checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Run &lt;code&gt;openssl s_client&lt;/code&gt; against every custom domain and note each root and intermediate.&lt;/li&gt;
&lt;li&gt;Replace anything chaining to emSign ECC Root CA - G3, or to the &lt;code&gt;EM ... TLS CA - G3B/G3C&lt;/code&gt; intermediates.&lt;/li&gt;
&lt;li&gt;Check &lt;code&gt;emSign Root CA - G1&lt;/code&gt; chains and their SCT dates, and plan to move off G1 before November 30.&lt;/li&gt;
&lt;li&gt;Test from curl, Python, Node.js and Go using the published test hosts, including the AAA and no-CT variants.&lt;/li&gt;
&lt;li&gt;Rebuild Go binaries and container images; recreate Java keystores; restart long-running services.&lt;/li&gt;
&lt;li&gt;Confirm whether each tunnel agent pins its provider’s CA or uses the host store.&lt;/li&gt;
&lt;li&gt;Send a real test webhook from each provider after changing the chain.&lt;/li&gt;
&lt;li&gt;Keep CAA records current so an emergency reissue is not blocked.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Do I need to act if I never used eMudhra?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
As a site owner, no. If you run non-browser HTTPS clients, yes. An attacker holding the keys could impersonate any site to a client that still trusts the root and skips revocation and CT checks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does a patched system store protect my Go and Node.js programs?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Not on its own. Node.js ships its own root list, and Go carries its own filter in the standard library. Upgrade, rebuild and restart.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is seeing “AAA Certificate Services” in my chain a problem?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Not by itself. It is a legitimate Sectigo root used by many chains. It only matters if the chain runs through an eMudhra intermediate, or if you are checking that a trust store can no longer validate the cross-signed weak keys.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How often should I audit?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
After any CA change, base-image upgrade, or root-program distrust announcement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.google/security/protecting-chrome-and-android-users-from-compromised-emudhra-intermediate-ca-certificates/" rel="noopener noreferrer"&gt;Google: Protecting Chrome and Android users from compromised eMudhra intermediate CA certificates&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://groups.google.com/a/ccadb.org/g/public/c/DU8p98nyQWc/m/R33zS9UIBgAJ" rel="noopener noreferrer"&gt;Chrome Root Program notice on emSign Root CA - G1 (CCADB Public)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://emudhra.we-have-a-problem.com/" rel="noopener noreferrer"&gt;eMudhra Intermediate CA Compromise (researcher’s disclosure and patch tracker)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://support.apple.com/en-ug/149555" rel="noopener noreferrer"&gt;Apple: About the compromised eMudhra intermediate CAs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ngrok.com/blog/emudhra-ca-compromise" rel="noopener noreferrer"&gt;ngrok: The default agent isn’t affected&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nodejs.org/en/blog/vulnerability/october-2026-security-releases" rel="noopener noreferrer"&gt;Node.js: October 2026 security releases&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://thehackernews.com/2026/10/go-issues-emergency-update-blocking.html" rel="noopener noreferrer"&gt;The Hacker News: Go issues emergency update blocking eight CA keys&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ctlogs.dev/blog/emudhra-ca-compromise" rel="noopener noreferrer"&gt;ctlogs.dev: eMudhra intermediate CA compromise (timeline and CT data)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bugzilla.mozilla.org/show_bug.cgi?id=2089115" rel="noopener noreferrer"&gt;Mozilla Bugzilla 2089115: emSign Root CA - G1 distrust-after&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.ssl.com/article/check-your-certificates-before-october-27-chrome-is-removing-an-emudhra-root/" rel="noopener noreferrer"&gt;SSL.com: Check your certificates before October 27&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cycode.com/blog/emudhra-intermediate-ca-compromise/" rel="noopener noreferrer"&gt;Cycode: How to test, patch and find old trust&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://fleetdm.com/articles/emudhra-ca-compromise-trust-stores-fleet" rel="noopener noreferrer"&gt;Fleet: Trust stores and the eMudhra compromise&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://instatunnel.my/blog/your-ca-got-distrusted-overnight-auditing-trust-stores-for-tunnel-agents-and-custom-domains" rel="noopener noreferrer"&gt;https://instatunnel.my/blog/your-ca-got-distrusted-overnight-auditing-trust-stores-for-tunnel-agents-and-custom-domains&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>networking</category>
    </item>
    <item>
      <title>Your Dev Server’s WebSocket Is Public Now: Cross-Site WebSocket Hijacking Behind a Tunnel</title>
      <dc:creator>InstaTunnel</dc:creator>
      <pubDate>Fri, 20 Nov 2026 01:41:19 +0000</pubDate>
      <link>https://dev.to/instatunnel/your-dev-servers-websocket-is-public-now-cross-site-websocket-hijacking-behind-a-tunnel-2cag</link>
      <guid>https://dev.to/instatunnel/your-dev-servers-websocket-is-public-now-cross-site-websocket-hijacking-behind-a-tunnel-2cag</guid>
      <description>&lt;p&gt;You ran &lt;code&gt;npm run dev&lt;/code&gt;, started a tunnel so a teammate could review your work, and shared the link. The page loads and hot reload works. But the page is not the only thing you published. The hot module replacement (HMR) WebSocket your framework opens in the background is now reachable from the internet too.&lt;/p&gt;

&lt;p&gt;That socket was designed for a world where only your own browser could talk to it. Several vulnerabilities from 2025 and 2026 show what happens when that assumption breaks. Next.js, Vite, webpack-dev-server, Mailpit and nginx-ui have all shipped fixes for WebSocket origin-validation problems, and webpack-dev-server’s most recent one landed in October 2026. This guide explains the attack class, what an &lt;code&gt;Origin&lt;/code&gt; check really protects against, why a missing or &lt;code&gt;null&lt;/code&gt; Origin deserves special attention, and what to do per framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is cross-site WebSocket hijacking (CSWSH)?
&lt;/h2&gt;

&lt;p&gt;Cross-site WebSocket hijacking is the WebSocket version of cross-site request forgery. Browsers do not apply the same-origin policy to WebSocket connections, and they attach the site’s cookies to the handshake request. A page on &lt;em&gt;any&lt;/em&gt; origin can therefore try to open a socket to your server. Unless the server checks the handshake itself, the connection succeeds with the victim’s credentials. OWASP’s WebSocket Security Cheat Sheet recommends validating the &lt;code&gt;Origin&lt;/code&gt; header on every handshake against an explicit allowlist. It also stresses that page JavaScript cannot override that header, and that wildcards and substring matching are error-prone.&lt;/p&gt;

&lt;p&gt;The handshake is an ordinary HTTP &lt;code&gt;GET&lt;/code&gt; with &lt;code&gt;Upgrade: websocket&lt;/code&gt;. The browser adds an &lt;code&gt;Origin&lt;/code&gt; header naming the page that started the connection, and the server decides whether to answer &lt;code&gt;101 Switching Protocols&lt;/code&gt; or refuse. Once the socket is open, the attacker’s script can read and send messages for as long as the tab stays open.&lt;/p&gt;

&lt;p&gt;Dev servers add a twist. They usually have no login, so the “credential” being abused is network position: the victim’s browser can reach &lt;code&gt;localhost:5173&lt;/code&gt;, and the attacker’s page borrows that reach. Vite’s advisory (CVE-2025-24010, January 2025) says outright that it applied even to people who only ran the dev server locally.&lt;/p&gt;

&lt;p&gt;For a dev server, the messages are the problem. Vite’s advisory notes that its socket carries the paths of changed files and the file content around build errors. It also warns that plugins can send arbitrary messages that may include more sensitive data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a tunnel changes the threat model
&lt;/h2&gt;

&lt;p&gt;Without a tunnel, a CSWSH attack needs a specific victim: you, running the server, visiting a malicious page on the same machine. That is real (it is why these CVEs exist), but narrow. A tunnel changes three things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Reach.&lt;/strong&gt; Anyone who learns the public URL can open a connection. They do not need your browser; a script that speaks the WebSocket protocol can connect from anywhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exposure window.&lt;/strong&gt; Tunnels can stay up for long stretches, and links get pasted into chats, tickets and screenshots.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trust confusion.&lt;/strong&gt; The dev server was built to trust &lt;code&gt;localhost&lt;/code&gt; and its own hostname. Behind a tunnel, requests arrive with a different &lt;code&gt;Host&lt;/code&gt; and &lt;code&gt;Origin&lt;/code&gt;, so people loosen checks to make the page work. That loosening is where much of the real exposure comes from.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The framework docs reflect this. The Next.js &lt;code&gt;allowedDevOrigins&lt;/code&gt; documentation says the dev server already allows &lt;code&gt;localhost&lt;/code&gt;, its subdomains and the hostname it was started with, and any other hostname, such as a tunnel used for remote development, needs an explicit entry. Vite’s &lt;code&gt;server.allowedHosts&lt;/code&gt; defaults to an empty list, with &lt;code&gt;localhost&lt;/code&gt;, &lt;code&gt;*.localhost&lt;/code&gt; and all IP addresses allowed implicitly. The Vite docs warn that setting it to &lt;code&gt;true&lt;/code&gt; lets any website reach your dev server through DNS rebinding and download your source. (Host-header allowlists are a separate topic; here we stay on the WebSocket upgrade.)&lt;/p&gt;

&lt;h2&gt;
  
  
  What an Origin check actually blocks
&lt;/h2&gt;

&lt;p&gt;An &lt;code&gt;Origin&lt;/code&gt; check answers one question: &lt;em&gt;which web page initiated this browser connection?&lt;/em&gt; Because the browser sets the header and page scripts cannot change it, the server can treat it as evidence of the calling page. That makes it effective against exactly one attacker: a malicious web page driving a victim’s browser.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Threat&lt;/th&gt;
&lt;th&gt;Does an Origin check stop it?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Malicious website opens a socket via the victim’s browser (CSWSH)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Yes&lt;/strong&gt;, if the allowlist is strict&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Attacker script or &lt;code&gt;curl&lt;/code&gt; connects straight to the public tunnel URL&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;No&lt;/strong&gt;. Non-browser clients can send any Origin, or none&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Someone opens your tunnel URL in their own browser&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Partly&lt;/strong&gt;. Their page is same-origin, so it passes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Stolen or guessed tunnel URL&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;No&lt;/strong&gt;. It is a credential-free endpoint&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This is the central lesson for tunnels. An Origin check defends against browsers being used as a confused deputy. It is not authentication. Once your dev server is reachable by raw clients, “we check Origin” is no barrier against a deliberate attacker, because forging the header takes one flag in any HTTP client. webpack-dev-server’s own release notes say as much about its cross-site protections: non-browser clients such as &lt;code&gt;curl&lt;/code&gt; are unaffected by them.&lt;/p&gt;

&lt;p&gt;It still matters, because it closes the drive-by path: a stranger’s web page cannot silently piggyback on a reviewer’s browser. But it needs a second layer in front (see below). SameSite cookies add defense in depth, since &lt;code&gt;Lax&lt;/code&gt; or &lt;code&gt;Strict&lt;/code&gt; cookies will not ride along on a cross-site handshake. They do not help if the attacker’s page lives on another subdomain of the same site, though.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a missing or &lt;code&gt;null&lt;/code&gt; Origin matters
&lt;/h2&gt;

&lt;p&gt;Two special cases cause most real bugs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A missing Origin.&lt;/strong&gt; Browsers send &lt;code&gt;Origin&lt;/code&gt; on WebSocket handshakes, but command-line tools and native clients do not. Servers often treat a missing header as “not a browser, so no CSWSH risk” and let it through. On a private loopback interface that can be defensible. Behind a tunnel it is a hole, because the missing-header path is exactly the path a direct attacker takes.&lt;/p&gt;

&lt;p&gt;Vite shows both sides of this. Its CSWSH fix (6.0.9 and later) verifies a token on handshakes that carry an &lt;code&gt;Origin&lt;/code&gt; header, while handshakes without one are let through for non-browser tooling. Then in April 2026, CVE-2026-39363 showed the cost. If a Vite dev server was exposed to the network with &lt;code&gt;--host&lt;/code&gt; and its WebSocket was left enabled, a client that connected with no &lt;code&gt;Origin&lt;/code&gt; header could invoke a module-fetching call over the socket. Combined with a &lt;code&gt;file://&lt;/code&gt; path and the &lt;code&gt;?raw&lt;/code&gt; suffix, that returned the contents of arbitrary files on the machine. The access checks that protect the HTTP side were not applied on that path. GitHub rates it High (CVSS 4.0: 8.2), and it is fixed in Vite 6.4.2, 7.3.2 and 8.0.5.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Origin: null&lt;/code&gt;.&lt;/strong&gt; The literal string &lt;code&gt;null&lt;/code&gt; is what browsers send for opaque origins. MDN lists the common cases: sandboxed iframes without &lt;code&gt;allow-same-origin&lt;/code&gt;, &lt;code&gt;data:&lt;/code&gt;, &lt;code&gt;file:&lt;/code&gt; and &lt;code&gt;blob:&lt;/code&gt; documents, and requests that crossed an origin boundary through a redirect. Chrome’s guidance on validating origins adds that two unrelated opaque contexts both serialize to &lt;code&gt;"null"&lt;/code&gt;, so comparing them as strings falsely equates them, and it recommends rejecting &lt;code&gt;"null"&lt;/code&gt; before comparing anything. Chrome’s guide also warns against &lt;code&gt;startsWith&lt;/code&gt; and &lt;code&gt;includes&lt;/code&gt; checks, since a prefix test passes a hostile domain like &lt;code&gt;app.example.com.attacker.example&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;An attacker can manufacture a null origin cheaply. A hostile page loads a sandboxed iframe whose script opens the WebSocket, and the browser sends &lt;code&gt;Origin: null&lt;/code&gt;. If your code treats &lt;code&gt;null&lt;/code&gt; as “local file, probably me,” that page walks straight in. That is the shape of CVE-2026-27977.&lt;/p&gt;

&lt;h2&gt;
  
  
  2026 case files
&lt;/h2&gt;

&lt;p&gt;The table summarizes the fixes covered below.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Project&lt;/th&gt;
&lt;th&gt;CVE&lt;/th&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;th&gt;Fixed in&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Next.js&lt;/td&gt;
&lt;td&gt;CVE-2026-27977&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Origin: null&lt;/code&gt; bypassed dev WebSocket protection&lt;/td&gt;
&lt;td&gt;16.1.7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Vite&lt;/td&gt;
&lt;td&gt;CVE-2026-39363&lt;/td&gt;
&lt;td&gt;File read over the WebSocket when no &lt;code&gt;Origin&lt;/code&gt; is sent&lt;/td&gt;
&lt;td&gt;6.4.2, 7.3.2, 8.0.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;webpack-dev-server&lt;/td&gt;
&lt;td&gt;CVE-2026-9595&lt;/td&gt;
&lt;td&gt;Broad &lt;code&gt;ws: true&lt;/code&gt; proxy swallowed the HMR socket&lt;/td&gt;
&lt;td&gt;5.2.5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;webpack-dev-server&lt;/td&gt;
&lt;td&gt;CVE-2026-112085&lt;/td&gt;
&lt;td&gt;Proxied WebSocket upgrades skipped Host/Origin checks&lt;/td&gt;
&lt;td&gt;5.2.7, 6.1.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mailpit&lt;/td&gt;
&lt;td&gt;CVE-2026-22689, then CVE-2026-67448&lt;/td&gt;
&lt;td&gt;Any origin accepted, then a percent-encoding bypass of the fix&lt;/td&gt;
&lt;td&gt;1.28.2, then 1.30.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;nginx-ui&lt;/td&gt;
&lt;td&gt;CVE-2026-34403&lt;/td&gt;
&lt;td&gt;Origin check always returned true&lt;/td&gt;
&lt;td&gt;2.3.5&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Next.js: &lt;code&gt;Origin: null&lt;/code&gt; as a bypass (CVE-2026-27977)
&lt;/h3&gt;

&lt;p&gt;The advisory (GHSA-jcc7-9wpm-mj36), published in March 2026, says that in &lt;code&gt;next dev&lt;/code&gt; from 16.0.1 up to but not including 16.1.7, cross-site protection for internal dev endpoints could treat &lt;code&gt;Origin: null&lt;/code&gt; as a bypass case, even when &lt;code&gt;allowedDevOrigins&lt;/code&gt; was configured. Version 16.1.7 sends &lt;code&gt;null&lt;/code&gt; through the same origin-allowance checks as every other origin. It affects development mode only, not &lt;code&gt;next start&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Severity is modest and depends on who scores it. GitHub’s advisory says Moderate, the CVSS 3.1 base score is 5.4, and the CVSS 4.0 score recorded in the CVE entry is 2.3. The lesson outweighs the score: a correctly configured allowlist was undone by one special-case branch. If you cannot upgrade, the advisory says to keep &lt;code&gt;next dev&lt;/code&gt; off untrusted networks and to reject &lt;code&gt;Origin: null&lt;/code&gt; requests and WebSocket upgrades to internal dev endpoints at a proxy. The CVE description for the affected versions also notes that apps with no &lt;code&gt;allowedDevOrigins&lt;/code&gt; set still allowed connections from any origin, so configure it explicitly.&lt;/p&gt;

&lt;p&gt;The same bug class hit production code in the same release. CVE-2026-27978 (CVSS 3.1: 4.3) fixed Server Action CSRF validation, which had treated &lt;code&gt;origin: null&lt;/code&gt; as if the header were missing. Requests from sandboxed iframes could skip origin verification entirely.&lt;/p&gt;

&lt;h3&gt;
  
  
  webpack-dev-server: when the proxy swallows or skips the checks (CVE-2026-9595 and CVE-2026-112085)
&lt;/h3&gt;

&lt;p&gt;Two 2026 advisories involve &lt;code&gt;devServer.proxy&lt;/code&gt; entries with &lt;code&gt;ws: true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CVE-2026-9595&lt;/strong&gt; (GHSA-mx8g-39q3-5c79, June 2026, CVSS 3.1: 5.3) is not a missing allowlist. When a proxy entry has a broad context such as &lt;code&gt;/&lt;/code&gt; and &lt;code&gt;ws: true&lt;/code&gt;, it also catches the dev server’s own HMR upgrade and forwards it to your proxy target. That sends the browser’s cookies and &lt;code&gt;Origin&lt;/code&gt; header to your backend, skips the dev server’s Host and Origin validation, and leaves the proxy and HMR writing to the same socket. It is fixed in 5.2.5.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CVE-2026-112085&lt;/strong&gt; (published October 22, 2026, CVSS 3.1: 8.2 High) is the mirror image. In versions before 5.2.7, and in 6.0.0, a proxy entry configured to forward WebSockets passed non-HMR upgrade requests to the proxy target without validating Host or Origin, so &lt;code&gt;allowedHosts&lt;/code&gt; protection did not apply to them. A malicious page visited by a developer could open a cross-origin socket through the dev server and read from and write to the proxied backend, even when the server was bound to loopback. It is fixed in 5.2.7 and 6.1.0.&lt;/p&gt;

&lt;p&gt;The maintainers’ workaround for both: scope proxy contexts to specific API paths, and drop &lt;code&gt;ws: true&lt;/code&gt; where you do not need it. If you tunnel a webpack project, target 5.2.7 or later (or 6.1.0 or later on the 6.x line).&lt;/p&gt;

&lt;p&gt;Earlier fixes are worth knowing too. Version 5.2.1 patched CVE-2025-30360, where any IP-address &lt;code&gt;Origin&lt;/code&gt; was always accepted, letting a malicious site served from a bare IP read source code in non-Chromium browsers. Version 5.2.6 added cross-site protection for the state-changing routes &lt;code&gt;/webpack-dev-server/invalidate&lt;/code&gt; and &lt;code&gt;/webpack-dev-server/open-editor&lt;/code&gt; (it checks &lt;code&gt;Sec-Fetch-Site&lt;/code&gt;, falling back to an Origin/Host comparison), so a cross-site page can no longer trigger a rebuild or open a file in your editor. It also made malformed &lt;code&gt;Host&lt;/code&gt; and &lt;code&gt;Origin&lt;/code&gt; values get handled gracefully.&lt;/p&gt;

&lt;p&gt;Vite has a related caveat. Its docs state that Vite does not check the origin of WebSocket requests it proxies. The proxy target is expected to do that, and the &lt;code&gt;rewriteWsOrigin&lt;/code&gt; option rewrites the origin and defeats such a check.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mailpit: a regression of its own fix (CVE-2026-22689, then CVE-2026-67448)
&lt;/h3&gt;

&lt;p&gt;Mailpit, the local email-testing tool, first accepted WebSocket connections from any origin (CVE-2026-22689, CVSS 6.5, fixed in 1.28.2, January 2026). A malicious site could watch events arrive on a developer’s default &lt;code&gt;ws://localhost:8025&lt;/code&gt;, including email subjects, sender and recipient details, and mailbox statistics.&lt;/p&gt;

&lt;p&gt;The fix later regressed. CVE-2026-67448, published August 20, 2026 (CVSS 6.5), affects 1.29.0 through 1.30.5. The origin middleware checked the raw request URI for the &lt;code&gt;/api/&lt;/code&gt; prefix while Go’s router matched on the percent-decoded path, so &lt;code&gt;/%61pi/events&lt;/code&gt; skipped the check and reached the events WebSocket. It is fixed in 1.30.6, and instances protected with &lt;code&gt;--ui-auth-file&lt;/code&gt; are not affected, because the encoded path still returns 401 there. A mail inbox is exactly what you should not publish by accident, so put authentication in front of any tunnel that points at it.&lt;/p&gt;

&lt;h3&gt;
  
  
  nginx-ui: every endpoint said yes (CVE-2026-34403)
&lt;/h3&gt;

&lt;p&gt;Before 2.3.5 (published April 20, 2026), every WebSocket endpoint in nginx-ui used an upgrader whose origin check unconditionally returned true. The advisory also notes that the frontend stored its JWT in a cookie set from JavaScript without &lt;code&gt;HttpOnly&lt;/code&gt; or an explicit &lt;code&gt;SameSite&lt;/code&gt; attribute. If a logged-in administrator visited an attacker’s page, that page could open authenticated sockets. The listed endpoints leak Nginx metrics, events and cluster node data, and one triggers a binary upgrade. GitHub’s advisory labels it High, and vulnerability databases report CVSS scores of 8.1 to 8.6. It is textbook CSWSH, and “always true” is a classic way to make a demo work that survives into production.&lt;/p&gt;

&lt;h2&gt;
  
  
  A per-framework checklist
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Next.js&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On 16.x, upgrade to 16.1.7 or later.&lt;/li&gt;
&lt;li&gt;Add only your exact tunnel hostname to &lt;code&gt;allowedDevOrigins&lt;/code&gt;. Entries are matched against the Origin’s hostname only, with no scheme or port. &lt;code&gt;*&lt;/code&gt; covers exactly one label and &lt;code&gt;**&lt;/code&gt; one or more (and only at the start of the pattern), so prefer a specific subdomain over a broad wildcard.&lt;/li&gt;
&lt;li&gt;Optionally reject &lt;code&gt;/_next/webpack-hmr&lt;/code&gt; upgrades carrying &lt;code&gt;Origin: null&lt;/code&gt; at a proxy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;webpack-dev-server&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upgrade to 5.2.7 or later (6.1.0 or later on 6.x), and check lockfiles, since older scaffolds can pin old versions.&lt;/li&gt;
&lt;li&gt;Replace &lt;code&gt;/&lt;/code&gt; proxy contexts with explicit paths such as &lt;code&gt;/api&lt;/code&gt;, and remove unneeded &lt;code&gt;ws: true&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Vite&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run a release that includes both the CVE-2025-24010 fixes (6.0.9, 5.4.12, 4.5.6 or newer) and the CVE-2026-39363 fixes (6.4.2, 7.3.2, 8.0.5 or newer).&lt;/li&gt;
&lt;li&gt;Add the tunnel hostname to &lt;code&gt;server.allowedHosts&lt;/code&gt; rather than setting it to &lt;code&gt;true&lt;/code&gt;, and never set &lt;code&gt;server.cors&lt;/code&gt; to &lt;code&gt;true&lt;/code&gt;. If you must expose the server with &lt;code&gt;--host&lt;/code&gt;, set &lt;code&gt;server.ws: false&lt;/code&gt; where you do not need HMR.&lt;/li&gt;
&lt;li&gt;Remember that a handshake without an &lt;code&gt;Origin&lt;/code&gt; header is treated as non-browser tooling, so allowing your tunnel’s Host means raw clients can still reach the socket. This is another reason to authenticate at the edge.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Mailpit and nginx-ui&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Mailpit 1.30.6 or later, with &lt;code&gt;--ui-auth-file&lt;/code&gt; if the UI is reachable beyond your machine. nginx-ui 2.3.5 or later, and never an admin panel on a quick tunnel.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Your own &lt;code&gt;ws&lt;/code&gt; or Socket.IO server&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify Origin in the HTTP &lt;code&gt;upgrade&lt;/code&gt; event before calling &lt;code&gt;handleUpgrade&lt;/code&gt; (OWASP recommends this over &lt;code&gt;verifyClient&lt;/code&gt;). Compare against an exact allowlist, never with &lt;code&gt;startsWith&lt;/code&gt; or &lt;code&gt;includes&lt;/code&gt;, and reject absent and &lt;code&gt;"null"&lt;/code&gt; values explicitly:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;allowed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"https://my-app.tunnel.example.com"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"upgrade"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;origin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;origin&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;origin&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"null"&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;allowed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"HTTP/1.1 403 Forbidden\r\n\r\n"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;destroy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;wss&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;handleUpgrade&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ws&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;wss&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;emit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"connection"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ws&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If you already use CSRF tokens, include one in the handshake. OWASP also advises checking authorization on every message, since an open socket should not mean unlimited access.&lt;/li&gt;
&lt;li&gt;In Go, never leave &lt;code&gt;CheckOrigin&lt;/code&gt; returning &lt;code&gt;true&lt;/code&gt;. That one line is the root of both the Mailpit and nginx-ui CVEs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Put authentication in front of the socket
&lt;/h2&gt;

&lt;p&gt;Because Origin checks do not stop direct clients, the strongest move is to make the tunnel itself demand credentials before any request, including the &lt;code&gt;Upgrade&lt;/code&gt; request, reaches your dev server. A password or Basic Auth gate at the tunnel edge means an unauthenticated visitor is refused before your HMR socket sees the handshake. It also covers framework versions you have not patched yet. (InstaTunnel’s pricing page lists password protection and basic auth under its Pro plan; check your own plan before relying on it.)&lt;/p&gt;

&lt;p&gt;Treat the gate and the Origin allowlist as two layers, not substitutes. The password stops strangers; the allowlist stops a hostile page from hijacking the session of a reviewer who has already signed in. Share the credential privately, and rotate it when the review ends, because a password pasted into a public ticket is no better than none.&lt;/p&gt;

&lt;p&gt;A sensible baseline for any shared dev tunnel: patched framework, exact-hostname allowlist, &lt;code&gt;null&lt;/code&gt; and missing Origin rejected where your framework allows it, and a password at the edge.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test your own setup in two minutes
&lt;/h2&gt;

&lt;p&gt;Run this against your tunnel URL. A secure setup refuses the upgrade instead of answering &lt;code&gt;101 Switching Protocols&lt;/code&gt;. The &lt;code&gt;--http1.1&lt;/code&gt; flag matters because the &lt;code&gt;Upgrade&lt;/code&gt; mechanism does not exist in HTTP/2, and &lt;code&gt;--max-time&lt;/code&gt; stops curl from hanging on an open socket:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -i -N --http1.1 --max-time 5 \
  -H &lt;span class="s2"&gt;"Connection: Upgrade"&lt;/span&gt; -H &lt;span class="s2"&gt;"Upgrade: websocket"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Sec-WebSocket-Version: 13"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ=="&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Origin: null"&lt;/span&gt; \
  https://your-tunnel.example.com/_next/webpack-hmr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Repeat with &lt;code&gt;-H "Origin: https://evil.example"&lt;/code&gt; and with the &lt;code&gt;Origin&lt;/code&gt; header omitted, using your framework’s real socket path. For Vite, also add &lt;code&gt;-H "Sec-WebSocket-Protocol: vite-hmr"&lt;/code&gt;. OWASP’s testing list suggests the same three ideas: connect from unauthorized origins, connect without credentials, and check what the server logs. Note that Vite is designed to let the no-Origin variant through for non-browser clients, so a &lt;code&gt;101&lt;/code&gt; there is expected and is exactly the case the edge password has to cover. If any variant returns &lt;code&gt;101&lt;/code&gt; and you have no gate in front, an unauthenticated client can talk to your HMR socket. With a password gate in place, all three should fail before reaching the framework, typically with a &lt;code&gt;401&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;One more operational note: ordinary HTTP access logs capture only the upgrade request, not the messages that follow. If you leave a tunnel running, log connection origins and failures so you can see who is knocking.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Am I at risk if I never use a tunnel?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
In a narrower way, yes. Most of these CVEs were exploitable from a malicious web page against a locally running server. Patch regardless; a tunnel only widens who can try.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is &lt;code&gt;Origin: null&lt;/code&gt; the same as no Origin header?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
No. A missing header usually means a non-browser client. A literal &lt;code&gt;null&lt;/code&gt; means a browser sent the request from an opaque context. Reject both unless you have a specific reason not to, and know that some frameworks (Vite, for one) deliberately accept the missing case.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does HTTPS on the tunnel fix this?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
No. TLS protects traffic in transit, but a hostile page can open a &lt;code&gt;wss://&lt;/code&gt; connection just as easily. The issue is who may connect, not whether the traffic is encrypted.&lt;/p&gt;

&lt;h2&gt;
  
  
  The takeaway
&lt;/h2&gt;

&lt;p&gt;Hot reload feels like a harmless convenience, but it is a long-lived, bidirectional channel into your toolchain. When a tunnel makes it public, the only things between that channel and the internet are your framework’s origin checks and whatever you add in front. The recent CVEs show those checks fail in surprising ways: a &lt;code&gt;null&lt;/code&gt; special case, a proxy that swallows or skips the upgrade checks, a percent-encoded path, a hard-coded &lt;code&gt;true&lt;/code&gt;, a missing header treated as trusted.&lt;/p&gt;

&lt;p&gt;Patch the frameworks, allowlist exact hostnames, refuse missing and &lt;code&gt;null&lt;/code&gt; origins where you can, and put a password at the edge. Then your tunnel shares what you meant to share: a preview of the page, not a live feed of your source code.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/vercel/next.js/security/advisories/GHSA-jcc7-9wpm-mj36" rel="noopener noreferrer"&gt;GitHub advisory GHSA-jcc7-9wpm-mj36 (Next.js, CVE-2026-27977)&lt;/a&gt; and &lt;a href="https://db.gcve.eu/vuln/CVE-2026-27977" rel="noopener noreferrer"&gt;CVE-2026-27977 record&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nvd.nist.gov/vuln/detail/cve-2026-27978" rel="noopener noreferrer"&gt;NVD: CVE-2026-27978 (Next.js Server Actions)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nextjs.org/docs/app/api-reference/config/next-config-js/allowedDevOrigins" rel="noopener noreferrer"&gt;Next.js docs: allowedDevOrigins&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cve.circl.lu/vuln/ghsa-mx8g-39q3-5c79" rel="noopener noreferrer"&gt;GHSA-mx8g-39q3-5c79 / CVE-2026-9595 (webpack-dev-server)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.tenable.com/cve/CVE-2026-112085" rel="noopener noreferrer"&gt;CVE-2026-112085 (webpack-dev-server)&lt;/a&gt; and &lt;a href="https://www.sentinelone.com/vulnerability-database/cve-2025-30360/" rel="noopener noreferrer"&gt;CVE-2025-30360 (webpack-dev-server)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://osv.dev/vulnerability/CVE-2026-67448" rel="noopener noreferrer"&gt;CVE-2026-67448 (Mailpit)&lt;/a&gt; and &lt;a href="https://advisories.gitlab.com/golang/github.com/axllent/mailpit/CVE-2026-22689/" rel="noopener noreferrer"&gt;CVE-2026-22689 (Mailpit)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://db.gcve.eu/vuln/cve-2026-34403" rel="noopener noreferrer"&gt;CVE-2026-34403 (nginx-ui)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/vitejs/vite/security/advisories/GHSA-vg6x-rcgg-rjx6" rel="noopener noreferrer"&gt;Vite advisory GHSA-vg6x-rcgg-rjx6 (CVE-2025-24010)&lt;/a&gt; and &lt;a href="https://db.gcve.eu/vuln/GHSA-P9FF-H696-F583" rel="noopener noreferrer"&gt;GHSA-p9ff-h696-f583 (CVE-2026-39363)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vite.dev/config/server-options" rel="noopener noreferrer"&gt;Vite docs: server options&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cheatsheetseries.owasp.org/cheatsheets/WebSocket_Security_Cheat_Sheet" rel="noopener noreferrer"&gt;OWASP WebSocket Security Cheat Sheet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.chrome.com/docs/modern-web-guidance/guides/security/validate-origins" rel="noopener noreferrer"&gt;Chrome: validate web origins&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en/docs/Web/HTTP/Headers/Origin" rel="noopener noreferrer"&gt;MDN: Origin header&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://instatunnel.my/pricing" rel="noopener noreferrer"&gt;InstaTunnel pricing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://instatunnel.my/blog/your-dev-servers-websocket-is-public-now-cross-site-websocket-hijacking-behind-a-tunnel" rel="noopener noreferrer"&gt;https://instatunnel.my/blog/your-dev-servers-websocket-is-public-now-cross-site-websocket-hijacking-behind-a-tunnel&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>networking</category>
    </item>
    <item>
      <title>Slack Classic Apps Didn’t Die on November 16: Events API over HTTP vs Socket Mode (and When You Still Need a Tunnel)</title>
      <dc:creator>InstaTunnel</dc:creator>
      <pubDate>Thu, 19 Nov 2026 01:41:56 +0000</pubDate>
      <link>https://dev.to/instatunnel/slack-classic-apps-didnt-die-on-november-16-events-api-over-http-vs-socket-mode-and-when-you-488k</link>
      <guid>https://dev.to/instatunnel/slack-classic-apps-didnt-die-on-november-16-events-api-over-http-vs-socket-mode-and-when-you-488k</guid>
      <description>&lt;p&gt;If you saw “classic apps stop working on November 16, 2026” in a changelog, a Slack thread or an old blog post, you may have checked your calendar this week with some dread. Here is the short version, checked against Slack’s developer docs on November 19, 2026: &lt;strong&gt;the shutdown did not happen.&lt;/strong&gt; Slack paused the classic apps deprecation on December 8, 2025. It says classic apps will keep working for the foreseeable future.&lt;/p&gt;

&lt;p&gt;That doesn’t mean you can ignore the topic. Slack still calls classic apps a legacy method of integrating with Slack, new classic apps can’t be created, and Slack highly recommends migrating to avoid future service interruptions. The engineering question behind the scare is a good one. Once you move to a modern Slack app, how should events reach your code, over &lt;strong&gt;HTTP request URLs or Socket Mode&lt;/strong&gt;? And when do you still need a tunnel on your laptop?&lt;/p&gt;

&lt;p&gt;This guide covers the real timeline, a decision framework, the &lt;code&gt;url_verification&lt;/code&gt; handshake, the retry rules, and the &lt;strong&gt;Delayed Events&lt;/strong&gt; setting that keeps retrying missed events after your dev machine falls asleep.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually happened to Slack classic apps
&lt;/h2&gt;

&lt;p&gt;The November 16, 2026 date was real, but it was never final. Slack moved it three times before pausing the whole thing:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Date announced&lt;/th&gt;
&lt;th&gt;What Slack said&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;September 30, 2024&lt;/td&gt;
&lt;td&gt;Classic apps to be discontinued in September 2025; legacy custom bots on March 31, 2025&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;November 7, 2024&lt;/td&gt;
&lt;td&gt;Classic apps date moved to March 31, 2026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;April 11, 2025&lt;/td&gt;
&lt;td&gt;Date moved to May 25, 2026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;July 29, 2025&lt;/td&gt;
&lt;td&gt;Date moved to November 16, 2026&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;December 8, 2025&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Migration paused&lt;/strong&gt;; classic apps continue to work&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Slack’s original 2024 announcement now shows the classic-app dates struck through, with a notice that changes relating to classic apps are paused. The original wording said classic apps would be rejected on API calls and would stop receiving Events API events. None of that is currently in force.&lt;/p&gt;

&lt;p&gt;Two related facts are worth keeping straight:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Legacy custom bots are a different story.&lt;/strong&gt; Slack stopped supporting them on March 31, 2025, and their API calls are rejected. Replacing one means creating a new Slack app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;“Paused” is not “safe.”&lt;/strong&gt; Slack still labels classic apps legacy and recommends migrating. The announcement doesn’t promise they will never be retired, so don’t treat the pause as a permanent guarantee.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why you should still migrate
&lt;/h2&gt;

&lt;p&gt;The core difference between classic apps and modern Slack apps is a more granular set of OAuth scopes. That matters for this article’s topic, because &lt;strong&gt;Socket Mode is only available to apps that use granular permissions&lt;/strong&gt;. If you created your app in December 2019 or later, you already have them. A classic app has to be migrated before you can turn on Socket Mode.&lt;/p&gt;

&lt;p&gt;Real-time messaging is the other legacy dependency. Slack apps don’t support the legacy RTM API. Slack’s guidance for legacy bots that used RTM is to move to the Events API, which can deliver most of the same events over HTTP or a WebSocket. If you want to keep an RTM-style pattern, enable Socket Mode, call &lt;code&gt;apps.connections.open&lt;/code&gt; to get a URL, open a WebSocket to it, and listen for events.&lt;/p&gt;

&lt;p&gt;The platform keeps moving in other ways too. On November 16, 2026, Slack announced that starting &lt;strong&gt;February 17, 2027&lt;/strong&gt; the Web API will reject &lt;code&gt;GET&lt;/code&gt; and &lt;code&gt;HEAD&lt;/code&gt; requests that include a request body. Those requests will fail with an HTTP 400, or an HTTP 403 once enforced at the CloudFront edge. Requests without a body and &lt;code&gt;POST&lt;/code&gt; requests aren’t affected. Many HTTP libraries add a small body (often an empty &lt;code&gt;{}&lt;/code&gt;) to a &lt;code&gt;GET&lt;/code&gt; when a body option is set. Slack lists axios with &lt;code&gt;data&lt;/code&gt;, Guzzle with &lt;code&gt;json&lt;/code&gt; or &lt;code&gt;form_params&lt;/code&gt;, and Python &lt;code&gt;requests&lt;/code&gt; or &lt;code&gt;aiohttp&lt;/code&gt; with &lt;code&gt;data=&lt;/code&gt; or &lt;code&gt;json=&lt;/code&gt; as common culprits. The fix is to put arguments in the query string and the token in the &lt;code&gt;Authorization: Bearer&lt;/code&gt; header.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two ways Slack delivers events
&lt;/h2&gt;

&lt;p&gt;With the Events API, Slack calls you. You choose one of two delivery paths in your app settings.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP request URLs
&lt;/h3&gt;

&lt;p&gt;You give Slack a public HTTPS endpoint. Slack sends one POST per event, with JSON in the body. Your server must reply with an HTTP 2xx within three seconds. Slack will follow up to two redirects.&lt;/p&gt;

&lt;p&gt;Things to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An app has &lt;strong&gt;one&lt;/strong&gt; Events API request URL, so you route events server-side.&lt;/li&gt;
&lt;li&gt;Request URLs are case-sensitive.&lt;/li&gt;
&lt;li&gt;HTTP is &lt;strong&gt;required&lt;/strong&gt; if you plan to submit the app to the Slack Marketplace.&lt;/li&gt;
&lt;li&gt;HTTP is stateless and scales well horizontally. Slack also considers short-lived HTTP connections inherently more reliable than long-lived ones.&lt;/li&gt;
&lt;li&gt;Every request must be verified with your signing secret (see below).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Socket Mode
&lt;/h3&gt;

&lt;p&gt;Your app opens an outbound WebSocket to Slack, so you don’t need a public endpoint. You generate an &lt;strong&gt;app-level token&lt;/strong&gt; (the docs show it as &lt;code&gt;xapp-…&lt;/code&gt;) and call &lt;code&gt;apps.connections.open&lt;/code&gt; to get a WebSocket URL. That method requires no scopes and must receive the token in the &lt;code&gt;Authorization&lt;/code&gt; header. The Bolt frameworks and Slack SDKs handle all of this if you set &lt;code&gt;SLACK_APP_TOKEN&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Things to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An app can hold up to &lt;strong&gt;10 simultaneous&lt;/strong&gt; WebSocket connections, and payloads may arrive on any of them, so don’t assume a pattern. Slack suggests extra connections for graceful restarts, load balancing and temporary active-active redundancy.&lt;/li&gt;
&lt;li&gt;The WebSocket URL is not static. Connections refresh regularly, roughly every few hours. Slack may send a &lt;code&gt;warning&lt;/code&gt; disconnect about 10 seconds ahead, then a &lt;code&gt;refresh_requested&lt;/code&gt; disconnect, so be ready to reconnect to a new URL quickly. Appending &lt;code&gt;&amp;amp;debug_reconnects=true&lt;/code&gt; to the URL shortens the connection to 360 seconds, which makes reconnect logic easy to test.&lt;/li&gt;
&lt;li&gt;You acknowledge each event by echoing its &lt;code&gt;envelope_id&lt;/code&gt;. You don’t need to verify signatures, because the socket is pre-authenticated.&lt;/li&gt;
&lt;li&gt;Apps using Socket Mode are not currently allowed in the public Slack Marketplace. You can still distribute them across your own Enterprise organization by making the app deployable organization-wide.&lt;/li&gt;
&lt;li&gt;Turning Socket Mode on means events and interactive payloads arrive &lt;strong&gt;only&lt;/strong&gt; over the WebSocket, not HTTP. If your app is live when you flip the switch, you can lose events until the socket connects. Your saved Request URL is kept, and used again if you switch back.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  HTTP vs Socket Mode: a decision guide
&lt;/h2&gt;

&lt;p&gt;Slack’s own recommendation is to use Socket Mode while developing locally, and HTTP request URLs once the app is deployed for a team. If your production app doesn’t need Socket Mode, Slack recommends sticking with HTTP, with fewer moving parts. In practice:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Your situation&lt;/th&gt;
&lt;th&gt;Pick&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Public Marketplace app&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Marketplace requires it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Internal tool behind a corporate firewall&lt;/td&gt;
&lt;td&gt;Socket Mode&lt;/td&gt;
&lt;td&gt;No public HTTP endpoint needed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Serverless or autoscaled production&lt;/td&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Stateless; scales horizontally&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Laptop prototype, no tunnel available&lt;/td&gt;
&lt;td&gt;Socket Mode&lt;/td&gt;
&lt;td&gt;Works with just an app-level token&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Team that wants identical dev and prod paths&lt;/td&gt;
&lt;td&gt;HTTP + tunnel&lt;/td&gt;
&lt;td&gt;One code path, fewer surprises&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Extra redundancy on the event feed&lt;/td&gt;
&lt;td&gt;Socket Mode with multiple connections&lt;/td&gt;
&lt;td&gt;Slack documents this as an option&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;One sensible pattern is Socket Mode for each developer’s personal dev app and HTTP in production. Since an app only has one Request URL, giving each developer their own dev app (for example, created from a shared manifest, which can set &lt;code&gt;socket_mode_enabled&lt;/code&gt;) avoids everyone fighting over a single URL.&lt;/p&gt;

&lt;h2&gt;
  
  
  When you still need a tunnel
&lt;/h2&gt;

&lt;p&gt;Socket Mode removes the tunnel for events, but a tunnel still earns its keep in several cases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;You want dev to match prod.&lt;/strong&gt; If production uses HTTP, testing signature verification, retry handling and response timing locally means exposing a real HTTPS endpoint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You’re building toward the Marketplace.&lt;/strong&gt; HTTP is mandatory there, so exercise that path before submission.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You’re testing retries and Delayed Events.&lt;/strong&gt; Those behaviors belong to HTTP delivery. A tunnel lets you stop your server on purpose and watch Slack retry.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You have other public URLs to expose.&lt;/strong&gt; Webhooks from third-party services you integrate with need a reachable address no matter how Slack events arrive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You share a dev environment.&lt;/strong&gt; A teammate or QA reviewer can hit your running endpoint without a VPN.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The practical requirement is a &lt;strong&gt;stable HTTPS URL&lt;/strong&gt;. Slack must confirm a Request URL before you can save it, so every time your tunnel URL changes you have to update the field and pass verification again. Look for a tunnel that offers a reserved or custom subdomain, which many tunneling tools do, sometimes only on paid tiers. Then you register the URL once and move on.&lt;/p&gt;

&lt;h2&gt;
  
  
  The url_verification challenge
&lt;/h2&gt;

&lt;p&gt;When you enter a Request URL, Slack sends an HTTP POST with an &lt;code&gt;application/json&lt;/code&gt; body containing three fields: &lt;code&gt;type&lt;/code&gt; set to &lt;code&gt;url_verification&lt;/code&gt;, a random &lt;code&gt;challenge&lt;/code&gt; string, and a deprecated &lt;code&gt;token&lt;/code&gt;. Slack won’t let you save the URL until you answer correctly.&lt;/p&gt;

&lt;p&gt;Reply with HTTP 200 and the challenge value. Slack accepts any of three formats:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Plain text containing the challenge string&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;application/x-www-form-urlencoded&lt;/code&gt; with a &lt;code&gt;challenge&lt;/code&gt; parameter&lt;/li&gt;
&lt;li&gt;JSON like &lt;code&gt;{"challenge": "..."}&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Practical notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slack verifies your SSL certificate during this step.&lt;/li&gt;
&lt;li&gt;If your dev server was asleep and the first attempt timed out, use the &lt;strong&gt;Retry&lt;/strong&gt; button in the form.&lt;/li&gt;
&lt;li&gt;This handshake happens at configuration time, so treat it as a special case at the top of your handler.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;token&lt;/code&gt; field is deprecated. For real events, verify requests with your &lt;strong&gt;signing secret&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Signing works like this. Slack adds &lt;code&gt;X-Slack-Signature&lt;/code&gt; and &lt;code&gt;X-Slack-Request-Timestamp&lt;/code&gt; headers. You build the base string &lt;code&gt;v0:&amp;lt;timestamp&amp;gt;:&amp;lt;raw body&amp;gt;&lt;/code&gt;, compute an HMAC SHA-256 hex digest with your signing secret, prefix it with &lt;code&gt;v0=&lt;/code&gt;, and compare it to the header using a constant-time comparison. Slack’s example rejects requests whose timestamp is more than five minutes from local time, to guard against replay attacks.&lt;/p&gt;

&lt;p&gt;Here is a minimal Express handler that verifies the signature, answers the challenge, acknowledges immediately, and defers the real work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"express"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;crypto&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"node:crypto"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="s2"&gt;"/slack/events"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// keep the raw body for signing&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;ts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"x-slack-request-timestamp"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;sig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"x-slack-signature"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;ts&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;sig&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ts&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;401&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"utf8"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;mine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
      &lt;span class="s2"&gt;"v0="&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
      &lt;span class="n"&gt;crypto&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createHmac&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"sha256"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SLACK_SIGNING_SECRET&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`v0:${ts}:${raw}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"hex"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mine&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sig&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timingSafeEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;401&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"url_verification"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"text/plain"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;challenge&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// acknowledge inside 3 seconds&lt;/span&gt;
    &lt;span class="nf"&gt;enqueue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;    &lt;span class="c1"&gt;// your queue: do the real work elsewhere&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The classic setup bug is a signature mismatch caused by parsing the body into JSON before computing the HMAC. Slack’s docs say to use the raw request body, before it has been deserialized. Bolt for JavaScript, Python and Java include built-in request verification, so if you use a Bolt framework you get this for free.&lt;/p&gt;

&lt;h2&gt;
  
  
  Acknowledge fast: retries and failure limits
&lt;/h2&gt;

&lt;p&gt;Slack’s delivery rules are the part most likely to bite a local developer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Respond within three seconds&lt;/strong&gt; with a 2xx. Otherwise the attempt counts as failed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Three retries&lt;/strong&gt; follow a failure: nearly immediately, after one minute, and after five minutes.&lt;/li&gt;
&lt;li&gt;Each retry carries an &lt;code&gt;x-slack-retry-num&lt;/code&gt; header (1, 2 or 3) and an &lt;code&gt;x-slack-retry-reason&lt;/code&gt; header. Documented reasons are &lt;code&gt;http_timeout&lt;/code&gt;, &lt;code&gt;too_many_redirects&lt;/code&gt;, &lt;code&gt;connection_failed&lt;/code&gt;, &lt;code&gt;ssl_error&lt;/code&gt;, &lt;code&gt;http_error&lt;/code&gt; and &lt;code&gt;unknown_error&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Return &lt;code&gt;x-slack-no-retry: 1&lt;/code&gt; on a failing response if you don’t want that specific event redelivered. Other events are unaffected.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto-disable:&lt;/strong&gt; if more than 95% of delivery attempts fail within 60 minutes (certificate errors, timeouts, too many redirects, or non-2xx responses), Slack temporarily disables your event subscriptions and emails the app’s owner. Retries count against this limit. Apps receiving fewer than 1,000 events per hour are not automatically disabled, which covers most dev apps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rate limit:&lt;/strong&gt; deliveries max out at 30,000 per workspace, per app, per 60 minutes. Beyond that you receive &lt;code&gt;app_rate_limited&lt;/code&gt; events every minute.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because retries mean the same event can arrive more than once, &lt;strong&gt;deduplicate on &lt;code&gt;event_id&lt;/code&gt;&lt;/strong&gt;, which Slack documents as globally unique across all workspaces. The retry header only tells you an attempt is a retry. It won’t tell you whether you already processed the original.&lt;/p&gt;

&lt;p&gt;The three-second rule is why LLM calls, database writes and API fan-outs should never run inline. Acknowledge, enqueue, process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Delayed Events: more retries for missed events
&lt;/h2&gt;

&lt;p&gt;Slack’s default behavior is that if your app doesn’t acknowledge an event, Slack makes its three retries over a few minutes and then stops. Separately, the Events API is described as a best-effort system, and delivery can be delayed during incidents. During a February 26–27, 2025 Events API incident, Slack paused the Events API queue to mitigate a concurrent outage. It chose not to replay the resulting backlog. Its stated reasons were that app event handling often depends on timely delivery for correctness, and that it wanted to avoid overloading its own systems and third-party systems with a surge.&lt;/p&gt;

&lt;p&gt;On &lt;strong&gt;February 5, 2026&lt;/strong&gt;, Slack announced &lt;strong&gt;Delayed Events&lt;/strong&gt;. Here is what the docs say it does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;With it enabled, Slack follows the three standard retries with &lt;strong&gt;hourly retries for 24 hours&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;By default, Slack won’t attempt to deliver an event that is more than &lt;strong&gt;two hours late&lt;/strong&gt;. With the feature on, it attempts delivery regardless of how late the event is.&lt;/li&gt;
&lt;li&gt;You enable it in your app settings: &lt;strong&gt;Event Subscriptions → Delayed Events&lt;/strong&gt;. It is a toggle, not a replay API you call.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The laptop-went-to-sleep scenario
&lt;/h3&gt;

&lt;p&gt;Say you close your laptop at 6 p.m. and open it at 9 a.m.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Delayed Events off:&lt;/strong&gt; each event from the evening exhausts its three retries within minutes, and Slack gives up on it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delayed Events on:&lt;/strong&gt; failed events keep being retried hourly for up to 24 hours. Once your tunnel is reachable again, you should see old events arrive in a burst as their hourly retries come around.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That burst is why your handler needs three defenses:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Idempotency.&lt;/strong&gt; Dedupe on &lt;code&gt;event_id&lt;/code&gt; so a retry doesn’t double-post a message.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Staleness checks.&lt;/strong&gt; Compare &lt;code&gt;event_time&lt;/code&gt; to now and decide whether a ten-hour-old &lt;code&gt;app_mention&lt;/code&gt; deserves a reply.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ordering tolerance.&lt;/strong&gt; Don’t assume events arrive in sequence. Use event timestamps.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Delayed Events is described in Slack’s docs in terms of acknowledging deliveries to your app, and those docs don’t spell out how it behaves under Socket Mode. Don’t assume parity, and test it before relying on it. Slack also describes the Events API as best-effort overall, so treat delayed delivery as extra coverage, not a guarantee.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Did Slack classic apps stop working on November 16, 2026?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
No. Slack paused the migration on December 8, 2025, and says classic apps will continue to work for the foreseeable future. They remain a legacy method, and Slack recommends migrating.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is Socket Mode or HTTP better?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
HTTP for production and Marketplace apps. Socket Mode for local development, firewalled environments and quick prototypes. Socket Mode requires granular permissions, so a classic app must migrate first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What does the url_verification challenge require?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
A 200 response containing the &lt;code&gt;challenge&lt;/code&gt; value, as plain text, form-encoded or JSON.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long does Slack retry failed events?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Three retries over about six minutes by default. With Delayed Events on, hourly retries continue for up to 24 hours.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/changelog/2025/12/08/classic-apps-deprecation-paused/" rel="noopener noreferrer"&gt;Classic apps deprecation paused (Slack changelog, December 8, 2025)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/changelog/2024-09-legacy-custom-bots-classic-apps-deprecation" rel="noopener noreferrer"&gt;Discontinuing support for legacy custom bots and classic apps (Slack changelog, September 30, 2024)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/changelog/2024/11/07/apps" rel="noopener noreferrer"&gt;Classic apps deprecation timeline adjustment (November 7, 2024)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/changelog/2025/04/11/classic-apps-extension" rel="noopener noreferrer"&gt;Classic apps deprecation timeline adjustment (April 11, 2025)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/changelog/2025/07/29/classic-apps-extension" rel="noopener noreferrer"&gt;Classic apps deprecation timeline adjustment (July 29, 2025)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/apis/events-api/" rel="noopener noreferrer"&gt;The Events API (Slack docs)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/apis/events-api/comparing-http-socket-mode" rel="noopener noreferrer"&gt;Comparing HTTP and Socket Mode (Slack docs)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/apis/events-api/using-socket-mode/" rel="noopener noreferrer"&gt;Using Socket Mode (Slack docs)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/apis/events-api/using-http-request-urls/" rel="noopener noreferrer"&gt;Using HTTP Request URLs (Slack docs)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/reference/methods/apps.connections.open" rel="noopener noreferrer"&gt;apps.connections.open method (Slack docs)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/authentication/verifying-requests-from-slack" rel="noopener noreferrer"&gt;Verifying requests from Slack (Slack docs)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/changelog/2026/02/05/retry-events-feature" rel="noopener noreferrer"&gt;Retry delayed events feature now available (Slack changelog, February 5, 2026)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.slack.dev/changelog/2026-11-get-head-requests-with-body" rel="noopener noreferrer"&gt;Web API GET and HEAD requests with a body will return 400 errors (Slack changelog, November 16, 2026)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://slack-status.com/2025-02/d41e4bfd1ccae26a" rel="noopener noreferrer"&gt;Slack incident report: Custom applications and bots may not be working as expected (February 26, 2025)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://instatunnel.my/blog/slack-classic-apps-didnt-die-on-november-16-events-api-over-http-vs-socket-mode-and-when-you-still-need-a-tunnel" rel="noopener noreferrer"&gt;https://instatunnel.my/blog/slack-classic-apps-didnt-die-on-november-16-events-api-over-http-vs-socket-mode-and-when-you-still-need-a-tunnel&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>tutorial</category>
    </item>
    <item>
      <title>Async AI Webhooks on Localhost: OpenAI Batch and Gemini’s Two Webhook Models</title>
      <dc:creator>InstaTunnel</dc:creator>
      <pubDate>Wed, 18 Nov 2026 01:43:35 +0000</pubDate>
      <link>https://dev.to/instatunnel/async-ai-webhooks-on-localhost-openai-batch-and-geminis-two-webhook-models-kf4</link>
      <guid>https://dev.to/instatunnel/async-ai-webhooks-on-localhost-openai-batch-and-geminis-two-webhook-models-kf4</guid>
      <description>&lt;p&gt;Batch jobs are expensive to debug. You submit thousands of prompts, wait hours, and your callback handler only sees real input when the job finishes. If the handler has a bug, the lazy fix is to run the batch again.&lt;/p&gt;

&lt;p&gt;You shouldn’t have to. OpenAI and Google now both push completion events instead of making you poll. Google announced event-driven webhooks for the Gemini API on May 4, 2026. OpenAI delivers callbacks that follow the Standard Webhooks specification for batches, background responses, fine-tuning jobs and other events. This guide is about the &lt;strong&gt;job lifecycle&lt;/strong&gt;. It covers how to receive these callbacks on localhost, how Gemini’s two configuration models differ, and why a batch success event gives you a pointer instead of results. It also shows how to iterate on your handler without paying for another batch.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Signature failures behind a tunnel, such as re-serialized bodies, are a separate topic and are not covered in depth here.)&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why long-running AI jobs need webhooks
&lt;/h2&gt;

&lt;p&gt;Polling works, but it wastes calls and adds latency. On OpenAI you poll &lt;code&gt;GET /v1/batches/{batch_id}&lt;/code&gt;. On Gemini, Google’s launch post describes repeatedly calling &lt;code&gt;GET&lt;/code&gt; on operations. Google frames the problem as agentic and high-volume work, such as Deep Research, long video generation, or thousands of prompts through the Batch API, where operations can take minutes or even hours.&lt;/p&gt;

&lt;p&gt;The completion window is the key number. OpenAI’s Batch API currently accepts only a &lt;code&gt;24h&lt;/code&gt; completion window, and its docs promise that each batch completes within 24 hours, often sooner. Gemini’s event catalog describes &lt;code&gt;batch.expired&lt;/code&gt; as a batch that wasn’t finished within a 24-hour timeframe. A callback can therefore arrive at any point inside that day. That is when your laptop is most likely to have changed networks, restarted or gone to sleep.&lt;/p&gt;

&lt;p&gt;Two status notes before you build on this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gemini’s webhooks documentation labels the feature as &lt;strong&gt;preview&lt;/strong&gt;, even though Google’s launch post says it is available to all Gemini API developers. Expect details to change and re-check the docs before you ship.&lt;/li&gt;
&lt;li&gt;OpenAI’s Batch API gives a 50% cost discount versus synchronous APIs. That discount is also why re-running a failed batch because of a handler bug is such a tempting and wasteful habit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  OpenAI and Gemini webhooks at a glance
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;OpenAI&lt;/th&gt;
&lt;th&gt;Gemini API&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Where configured&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Per project: dashboard (name, public URL, event types) or the webhooks API&lt;/td&gt;
&lt;td&gt;Static: &lt;code&gt;WebhookService&lt;/code&gt; API. Dynamic: &lt;code&gt;webhook_config&lt;/code&gt; on a request&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Batch events&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;batch.completed&lt;/code&gt;, &lt;code&gt;batch.failed&lt;/code&gt;, &lt;code&gt;batch.cancelled&lt;/code&gt;, &lt;code&gt;batch.expired&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;batch.succeeded&lt;/code&gt;, &lt;code&gt;batch.failed&lt;/code&gt;, &lt;code&gt;batch.cancelled&lt;/code&gt;, &lt;code&gt;batch.expired&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Other async events&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;response.completed&lt;/code&gt;/&lt;code&gt;failed&lt;/code&gt;/&lt;code&gt;cancelled&lt;/code&gt;/&lt;code&gt;incomplete&lt;/code&gt;, &lt;code&gt;fine_tuning.job.succeeded&lt;/code&gt;/&lt;code&gt;failed&lt;/code&gt;/&lt;code&gt;cancelled&lt;/code&gt;, &lt;code&gt;eval.run.succeeded&lt;/code&gt;/&lt;code&gt;failed&lt;/code&gt;/&lt;code&gt;canceled&lt;/code&gt;, &lt;code&gt;realtime.call.incoming&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;interaction.requires_action&lt;/code&gt;/&lt;code&gt;completed&lt;/code&gt;/&lt;code&gt;failed&lt;/code&gt;/&lt;code&gt;cancelled&lt;/code&gt;, &lt;code&gt;video.generated&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Signing&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Standard Webhooks headers (&lt;code&gt;webhook-id&lt;/code&gt;, &lt;code&gt;webhook-timestamp&lt;/code&gt;, &lt;code&gt;webhook-signature&lt;/code&gt;); secret shown once at endpoint creation&lt;/td&gt;
&lt;td&gt;Static: Standard Webhooks HMAC, secret shown once. Dynamic: RS256 JWT in the &lt;code&gt;Webhook-Signature&lt;/code&gt; header, verified against a JWKS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Payload style&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Thin: &lt;code&gt;object&lt;/code&gt;, event &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;type&lt;/code&gt;, &lt;code&gt;created_at&lt;/code&gt;, &lt;code&gt;data.id&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Thin: &lt;code&gt;type&lt;/code&gt;, &lt;code&gt;version&lt;/code&gt;, &lt;code&gt;timestamp&lt;/code&gt;, &lt;code&gt;data&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Retries&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Non-2xx or no response within a few seconds is retried for up to 72 hours with exponential backoff; 3xx redirects are not followed&lt;/td&gt;
&lt;td&gt;Retried for 24 hours with exponential backoff; respond &lt;code&gt;2xx&lt;/code&gt; within a few seconds&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Maturity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Documented guide and API reference&lt;/td&gt;
&lt;td&gt;Marked preview in the docs&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Three details matter immediately.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The success event is named differently.&lt;/strong&gt; It is &lt;code&gt;batch.completed&lt;/code&gt; on OpenAI and &lt;code&gt;batch.succeeded&lt;/code&gt; on Gemini. A shared handler keyed on the &lt;code&gt;type&lt;/code&gt; string needs an explicit mapping.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Both providers deliver at least once&lt;/strong&gt;, so duplicates can happen. Use the &lt;code&gt;webhook-id&lt;/code&gt; header as your idempotency key. OpenAI’s docs recommend this explicitly. Gemini’s documented payload example has no event ID in the body, so the header is the only reliable choice there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A “completed” OpenAI batch doesn’t promise every request succeeded.&lt;/strong&gt; The batch object tracks &lt;code&gt;request_counts&lt;/code&gt; (total, completed, failed) and separates &lt;code&gt;output_file_id&lt;/code&gt; from &lt;code&gt;error_file_id&lt;/code&gt;. A completed batch can still contain failed lines.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Gemini’s two webhook models: static vs dynamic
&lt;/h2&gt;

&lt;p&gt;This is the part that genuinely differs from OpenAI, and the reason Gemini handlers are harder to test.&lt;/p&gt;

&lt;h3&gt;
  
  
  Static webhooks: register once, receive everything
&lt;/h3&gt;

&lt;p&gt;Static webhooks are project-level endpoints created through the &lt;code&gt;WebhookService&lt;/code&gt; API. They trigger for any matching event in the project. Beyond creating them, you can get, list, update and delete them, and rotate their signing secret.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;google&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;genai&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;genai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;http_options&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"api_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"v1beta"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;webhook&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;webhooks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"MyBatchWebhook"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;subscribed_events&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"batch.succeeded"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"batch.failed"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"https://my-api.com/gemini-callback"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# The signing secret is returned only once. Store it securely.&lt;/span&gt;
&lt;span class="n"&gt;webhook_secret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;webhook&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;new_signing_secret&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Static webhooks are signed with HMAC under the Standard Webhooks scheme. The signing secret is shown only at creation, and if you lose it you rotate rather than retrieve. Rotation lets you choose whether previous secrets are revoked immediately or after a 24-hour grace period (&lt;code&gt;revocation_behavior="revoke_previous_secrets_after_h24"&lt;/code&gt; in the Python SDK). The grace period lets the old secret keep working while you deploy the new one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Local-development gotcha:&lt;/strong&gt; a static webhook covers the whole project. A dev endpoint registered in the same Google Cloud project as production will receive production events, and production will receive yours. Use a separate project and API key for development. OpenAI has the same shape: its webhook endpoints are configured per project, so use a separate project for dev there too.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dynamic webhooks: per-job overrides
&lt;/h3&gt;

&lt;p&gt;Dynamic webhooks are request-level overrides. You pass a &lt;code&gt;webhook_config&lt;/code&gt; in the call that creates the job. Google’s launch post shows this for a batch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;google&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;genai&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;genai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;file_batch_job&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;batches&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;your-model&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;inline_requests&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"display_name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"My Setup"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"webhook_config"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s2"&gt;"uris"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"https://my-api.com/gemini-webhook-dynamic"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="s2"&gt;"user_metadata"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"job_group"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"nightly-eval"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"priority"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"high"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Four details are worth knowing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;uris&lt;/code&gt; is a list, and &lt;code&gt;user_metadata&lt;/code&gt; is an arbitrary key-value object you attach to the job. The documented thin payload example doesn’t show &lt;code&gt;user_metadata&lt;/code&gt; coming back in the delivery. Before you route on it, check a captured real delivery to see whether and where it appears.&lt;/li&gt;
&lt;li&gt;For the Interactions API, &lt;code&gt;background=True&lt;/code&gt; is required whenever &lt;code&gt;webhook_config&lt;/code&gt; is set. Google’s Interactions examples also carry a comment that they only work with SDK versions newer than 2.0.0.&lt;/li&gt;
&lt;li&gt;Dynamic webhooks use asymmetric signatures. Your listener reads a JWT from the &lt;code&gt;Webhook-Signature&lt;/code&gt; header and verifies it against Google’s public keys (RS256).&lt;/li&gt;
&lt;li&gt;Google’s docs are inconsistent about where those keys live. The prose links to &lt;code&gt;https://www.googleapis.com/oauth2/v3/certs&lt;/code&gt;, while the sample code fetches &lt;code&gt;https://generativelanguage.googleapis.com/.well-known/jwks.json&lt;/code&gt;. The samples also pass a placeholder &lt;code&gt;audience&lt;/code&gt; value, with a comment suggesting something like your project client ID. Confirm the exact key URL and audience against the current docs before you enforce either.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A handler that supports both models therefore needs two verification paths, because a Standard Webhooks library will not verify the dynamic JWT. Google’s samples fetch the key set on every request. In production you should cache it and refetch when you see an unknown &lt;code&gt;kid&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which should you use?
&lt;/h3&gt;

&lt;p&gt;Use &lt;strong&gt;static&lt;/strong&gt; for things that should always happen: audit logging, a Slack notification, a data-sync job. Use &lt;strong&gt;dynamic&lt;/strong&gt; when you want specific jobs routed to specific places, such as a worker queue per tenant, or one developer’s batch landing on that developer’s machine without touching shared project configuration. For local debugging, dynamic is often the safer choice. The callback target lives in the job, not in project state your teammates share.&lt;/p&gt;

&lt;h2&gt;
  
  
  The batch success payload is a pointer, not the result
&lt;/h2&gt;

&lt;p&gt;Neither provider sends you the output. Google’s envelope is explicitly a “thin payload” model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"batch.succeeded"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"timestamp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"2026-01-22T12:00:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"batch_123456"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"output_file_uri"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"gs://my-bucket/results.jsonl"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Google’s example uses a &lt;code&gt;gs://&lt;/code&gt; Cloud Storage-style URI, which is not an HTTPS link you can fetch with a plain GET. The docs don’t say how your handler should download it, so don’t hard-code assumptions. Capture a real delivery and see what your jobs actually return. Google’s own samples also check whether &lt;code&gt;output_file_uri&lt;/code&gt; is present before using it, with a comment tying it to batch jobs created from an input file. Don’t assume the field exists on every &lt;code&gt;batch.succeeded&lt;/code&gt; event.&lt;/p&gt;

&lt;p&gt;The other Gemini batch events carry different data. &lt;code&gt;batch.failed&lt;/code&gt; includes &lt;code&gt;error_code&lt;/code&gt; and &lt;code&gt;error_message&lt;/code&gt;, while &lt;code&gt;batch.cancelled&lt;/code&gt; and &lt;code&gt;batch.expired&lt;/code&gt; carry only the &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;OpenAI’s pattern is similar. The &lt;code&gt;data&lt;/code&gt; object holds only the batch ID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"evt_abc123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"batch.completed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"created_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1719168000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"batch_abc123"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To get results, you call the Batch API, read &lt;code&gt;output_file_id&lt;/code&gt; from the batch object, and download it through the Files API. Read &lt;code&gt;error_file_id&lt;/code&gt; for failed requests. Four details matter here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Output lines may not match input order, so map results back with the &lt;code&gt;custom_id&lt;/code&gt; on each line.&lt;/li&gt;
&lt;li&gt;If a batch expires, completed requests’ responses are still made available in the output file. Unfinished requests land in the error file with a &lt;code&gt;batch_expired&lt;/code&gt; error, and you’re charged for the completed ones. A handler for &lt;code&gt;batch.expired&lt;/code&gt; should therefore still look for output.&lt;/li&gt;
&lt;li&gt;Cancelling a batch moves it to &lt;code&gt;cancelling&lt;/code&gt; first, which can take up to 10 minutes while in-flight requests finish. A &lt;code&gt;batch.cancelled&lt;/code&gt; event is not instant.&lt;/li&gt;
&lt;li&gt;By default, batch output and error files expire 30 days after creation. You can change this with &lt;code&gt;output_expires_after&lt;/code&gt; (1 hour to 30 days) when creating the batch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the webhook is a notification, and the real work happens in a second step. That split is the key to cheap debugging, because you can test the two halves separately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debug the callback without re-running the batch
&lt;/h2&gt;

&lt;p&gt;Here’s a workflow that avoids paying for a second batch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Capture one real delivery.&lt;/strong&gt; Submit a small batch, then record exactly what arrives: headers and raw body. A tiny Express recorder does it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"express"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;fs&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"node:fs"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mkdirSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"fixtures"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;recursive&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Keep the raw body: signature verification needs the exact bytes&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/json"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/hooks/:provider"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;fs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeFileSync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="sb"&gt;`fixtures/${req.params.provider}-${Date.now()}.json`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Respond &lt;code&gt;2xx&lt;/code&gt; quickly. Both providers retry if you don’t answer within a few seconds, so record first and process later. Fixtures contain job IDs and possibly output locations, so keep them out of version control.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Separate verification from handling.&lt;/strong&gt; Structure your code as &lt;code&gt;verify(request) -&amp;gt; event&lt;/code&gt; followed by &lt;code&gt;handle(event)&lt;/code&gt;. Then you can feed saved events straight to &lt;code&gt;handle()&lt;/code&gt; and skip signature checks entirely. The verification helpers already exist. OpenAI’s SDKs provide &lt;code&gt;client.webhooks.unwrap(body, headers)&lt;/code&gt;. For Gemini static webhooks, Google’s samples use the &lt;code&gt;standardwebhooks&lt;/code&gt; library. For dynamic ones you verify the JWT yourself.&lt;/p&gt;

&lt;p&gt;This split matters most for Gemini dynamic webhooks. You can’t re-sign a saved delivery, because you don’t hold Google’s private key. A saved token may stop verifying, for example if it expires or Google rotates keys, and the docs don’t say how long tokens stay valid. Replaying the parsed event into &lt;code&gt;handle()&lt;/code&gt; avoids the problem entirely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Normalize event names at the boundary.&lt;/strong&gt; Map each provider’s type strings to one internal vocabulary before your business logic sees them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="no"&gt;TERMINAL_STATUS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"openai"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"batch.completed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"succeeded"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"openai"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"batch.failed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"failed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"openai"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"batch.cancelled"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"cancelled"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"openai"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"batch.expired"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"expired"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"gemini"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"batch.succeeded"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"succeeded"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"gemini"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"batch.failed"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"failed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"gemini"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"batch.cancelled"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"cancelled"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"gemini"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"batch.expired"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"expired"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Mind the freshness window.&lt;/strong&gt; Google’s best practices tell you to reject payloads whose &lt;code&gt;webhook-timestamp&lt;/code&gt; is older than five minutes, to mitigate replay attacks. A saved fixture replayed an hour later should fail a correct handler. For static Gemini and OpenAI-style signatures, re-sign fixtures with a test secret and a fresh timestamp, or make the tolerance configurable in development only.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Stub the pointer fetch.&lt;/strong&gt; Put a small output file on disk and swap your Files API or storage reader for a local one. Now the success event becomes a fast, offline test that needs no cloud credentials.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Test the sad paths.&lt;/strong&gt; Save fixtures for &lt;code&gt;batch.failed&lt;/code&gt;, &lt;code&gt;batch.expired&lt;/code&gt; and &lt;code&gt;batch.cancelled&lt;/code&gt; as well, since you rarely get to see these in real traffic. Include an OpenAI batch with a non-empty &lt;code&gt;error_file_id&lt;/code&gt;. Also hand-write a duplicate delivery with the same &lt;code&gt;webhook-id&lt;/code&gt; to confirm your idempotency check works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Use provider test tools where they exist.&lt;/strong&gt; OpenAI’s dashboard webhook settings page can trigger test events with sample data, and its API reference lists a “Test Webhook Endpoint” method. Gemini’s webhook docs don’t describe an equivalent, so your recorded fixtures do that job.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Reconcile with one poll.&lt;/strong&gt; Retries are finite: 24 hours on Gemini, up to 72 on OpenAI. If your endpoint is down for longer than that, the event is gone, and a batch can itself legitimately take up to 24 hours. On startup, scan your job ledger for jobs still marked &lt;code&gt;submitted&lt;/code&gt; and check their status with one &lt;code&gt;GET&lt;/code&gt;. Treat webhooks as the fast path and polling as a safety net. Do this before the output files expire, which is 30 days by default on OpenAI.&lt;/p&gt;

&lt;p&gt;Your ledger can be simple: job ID, provider, status (&lt;code&gt;submitted&lt;/code&gt;, &lt;code&gt;succeeded&lt;/code&gt;, &lt;code&gt;failed&lt;/code&gt;, &lt;code&gt;cancelled&lt;/code&gt;, &lt;code&gt;expired&lt;/code&gt;) and the last &lt;code&gt;webhook-id&lt;/code&gt; processed. Neither provider’s docs promise delivery ordering, so apply updates only if they move a job forward, never backward.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where a stable tunnel subdomain helps
&lt;/h2&gt;

&lt;p&gt;Localhost isn’t reachable by Google or OpenAI, so you need a public HTTPS URL. OpenAI’s own guide acknowledges this and suggests tools such as ngrok, or cloud development environments like Replit, GitHub Codespaces, Cloudflare Workers and v0. What matters for batch work is whether that URL stays the same.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI endpoints and static Gemini webhooks are registered once.&lt;/strong&gt; If the URL changes every session, you’re back in the dashboard or the API updating it. A fixed hostname can be registered once and left alone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Gemini webhooks put the URL inside each job.&lt;/strong&gt; You can bake a stable hostname into &lt;code&gt;webhook_config.uris&lt;/code&gt; in your submission code, so every job you launch already points home.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Avoid redirects on the registered URL.&lt;/strong&gt; OpenAI does not follow &lt;code&gt;3xx&lt;/code&gt; responses and treats them as failures, so register the final HTTPS URL, including the exact path.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Session length should match the job horizon.&lt;/strong&gt; InstaTunnel’s README advertises a free tier with 24+ hour sessions, custom subdomains such as &lt;code&gt;myapp.instatunnel.my&lt;/code&gt;, and three simultaneous tunnels. Its published Pro tier is $5/month. Check the current pricing page for limits before relying on any of this. A tunnel session that lasts as long as a 24-hour batch window doesn’t guarantee a single session covers the whole job. Provider retries mean a short reconnect shouldn’t lose the event, as long as you come back on the same address.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install -g instatunnel
instatunnel 3000 --subdomain my-app
&lt;span class="c"&gt;# https://my-app.instatunnel.my -&amp;gt; localhost:3000&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One tunnel is enough if you route by path (&lt;code&gt;/hooks/openai&lt;/code&gt;, &lt;code&gt;/hooks/gemini-static&lt;/code&gt;, &lt;code&gt;/hooks/gemini-dynamic&lt;/code&gt;). A separate tunnel per integration is optional, for example if you want separate logs. Either way, keep Gemini’s dev project separate from production so the static endpoint only receives your own events.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checklist before you ship
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Map event names explicitly: &lt;code&gt;batch.completed&lt;/code&gt; (OpenAI) and &lt;code&gt;batch.succeeded&lt;/code&gt; (Gemini).&lt;/li&gt;
&lt;li&gt;Read the raw body before any JSON middleware touches it.&lt;/li&gt;
&lt;li&gt;Return &lt;code&gt;2xx&lt;/code&gt; fast, then queue the real work.&lt;/li&gt;
&lt;li&gt;Deduplicate on &lt;code&gt;webhook-id&lt;/code&gt;, and keep dedupe records longer than the retry window (72 hours for OpenAI).&lt;/li&gt;
&lt;li&gt;Check for failed lines in a “completed” OpenAI batch via &lt;code&gt;error_file_id&lt;/code&gt;, and look for partial output on &lt;code&gt;batch.expired&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Don’t assume &lt;code&gt;output_file_uri&lt;/code&gt; is present on every Gemini event, and verify what your real deliveries contain.&lt;/li&gt;
&lt;li&gt;Run two verifiers if you use both Gemini models, and cache the JWKS.&lt;/li&gt;
&lt;li&gt;Don’t register URLs that redirect; OpenAI won’t follow them.&lt;/li&gt;
&lt;li&gt;Add a reconciliation poll for jobs that outlive your endpoint’s downtime.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Do Gemini webhooks work with the Batch API?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Yes. Batch is a main use case, with &lt;code&gt;batch.succeeded&lt;/code&gt;, &lt;code&gt;batch.failed&lt;/code&gt;, &lt;code&gt;batch.cancelled&lt;/code&gt; and &lt;code&gt;batch.expired&lt;/code&gt; events. Webhooks also cover Interactions and video generation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are Gemini webhooks generally available?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Google’s launch post says they’re available to all developers using the Gemini API, but the documentation currently marks the feature as preview. Re-check the docs before depending on specifics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What’s the difference between static and dynamic Gemini webhooks?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Static webhooks are project-level endpoints created through the &lt;code&gt;WebhookService&lt;/code&gt; API and signed with an HMAC secret. Dynamic webhooks are set per request via &lt;code&gt;webhook_config&lt;/code&gt; and signed with a JWT you verify against Google’s public keys.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does the webhook contain my batch results?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
No. Gemini sends a pointer (such as the &lt;code&gt;output_file_uri&lt;/code&gt; in Google’s example), and OpenAI sends only the batch ID, after which you retrieve the output file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long do providers keep retrying?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Google retries for 24 hours with exponential backoff. OpenAI retries for up to 72 hours with exponential backoff.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I test OpenAI webhooks without running a job?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Yes. The dashboard webhook settings page can send test events with sample data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Will OpenAI follow a redirect on my webhook URL?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
No. &lt;code&gt;3xx&lt;/code&gt; responses are treated as failures, so register the final destination URL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Async AI callbacks are easy to receive and hard to debug because their inputs are expensive to reproduce. Capture one real delivery, separate verification from handling, stub the result fetch, and keep a polling sweep for anything that outlives your retry window. Then the batch only has to run once, and everything after that is a fixture.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.google/innovation-and-ai/technology/developers-tools/event-driven-webhooks/" rel="noopener noreferrer"&gt;Google: Reduce friction and latency for long-running jobs with Webhooks in Gemini API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ai.google.dev/gemini-api/docs/webhooks" rel="noopener noreferrer"&gt;Gemini API Webhooks documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.openai.com/api/docs/guides/webhooks" rel="noopener noreferrer"&gt;OpenAI: Webhooks guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.openai.com/api/docs/guides/batch" rel="noopener noreferrer"&gt;OpenAI: Batch API guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.openai.com/api/reference/resources/webhooks" rel="noopener noreferrer"&gt;OpenAI API reference: webhook events&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/standard-webhooks/standard-webhooks/blob/main/spec/standard-webhooks.md" rel="noopener noreferrer"&gt;Standard Webhooks specification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://app.unpkg.com/instatunnel@1.1.3/files/README.md" rel="noopener noreferrer"&gt;InstaTunnel npm package README&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://instatunnel.my/blog/async-ai-webhooks-on-localhost-openai-batch-and-geminis-two-webhook-models" rel="noopener noreferrer"&gt;https://instatunnel.my/blog/async-ai-webhooks-on-localhost-openai-batch-and-geminis-two-webhook-models&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>programming</category>
    </item>
    <item>
      <title>Telegram Bots and Mini Apps on Localhost: setWebhook, the Secret-Token Header, and the New Origin Check</title>
      <dc:creator>InstaTunnel</dc:creator>
      <pubDate>Tue, 17 Nov 2026 01:42:22 +0000</pubDate>
      <link>https://dev.to/instatunnel/telegram-bots-and-mini-apps-on-localhost-setwebhook-the-secret-token-header-and-the-new-origin-p8g</link>
      <guid>https://dev.to/instatunnel/telegram-bots-and-mini-apps-on-localhost-setwebhook-the-secret-token-header-and-the-new-origin-p8g</guid>
      <description>&lt;p&gt;Telegram can only deliver updates to a public HTTPS address, and &lt;code&gt;localhost&lt;/code&gt; is not one. Since July 20, 2026, Mini Apps have a second constraint. Telegram now blocks Mini App methods when they are called from a different origin than the Mini App’s own domain. Together, these two facts make your tunnel URL a first-class piece of configuration, not a throwaway detail.&lt;/p&gt;

&lt;p&gt;This guide covers developing a Telegram bot and Mini App against a local machine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;registering the webhook with &lt;code&gt;setWebhook&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;authenticating requests with the secret-token header&lt;/li&gt;
&lt;li&gt;handling unknown update fields without triggering retries&lt;/li&gt;
&lt;li&gt;validating Mini App &lt;code&gt;initData&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;understanding what the new origin check does to a development setup&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What changed in Bot API 10.2 (and what has shipped since)
&lt;/h2&gt;

&lt;p&gt;Telegram released &lt;strong&gt;Bot API 10.2 on July 14, 2026&lt;/strong&gt;. According to the official changelog, that release also hardened Mini App security by disallowing Mini App methods from origins different from the original Mini App domain. The protection was &lt;strong&gt;enabled automatically for all Mini Apps on July 20, 2026&lt;/strong&gt;. Bots can opt out through the BotFather Mini App. Opting out means taking responsibility for ensuring the Mini App has no links to untrusted sites. Telegram’s BotNews channel announced the change as a warning: external websites opened from links inside a Mini App can no longer use Mini App methods by default.&lt;/p&gt;

&lt;p&gt;Other 10.2 additions are worth knowing about, because they show up in your webhook payloads:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ephemeral messages:&lt;/strong&gt; new edit and delete methods, plus &lt;code&gt;receiver_user&lt;/code&gt; and &lt;code&gt;ephemeral_message_id&lt;/code&gt; on &lt;code&gt;Message&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rich messages:&lt;/strong&gt; &lt;code&gt;InputRichMessage&lt;/code&gt; gained &lt;code&gt;blocks&lt;/code&gt; and &lt;code&gt;media&lt;/code&gt; fields.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Communities:&lt;/strong&gt; a new &lt;code&gt;Community&lt;/code&gt; type, &lt;code&gt;community_chat_added&lt;/code&gt; and &lt;code&gt;community_chat_removed&lt;/code&gt; service messages, and a &lt;code&gt;community&lt;/code&gt; field on &lt;code&gt;ChatFullInfo&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Subscriptions:&lt;/strong&gt; a new top-level &lt;code&gt;subscription&lt;/code&gt; field on &lt;code&gt;Update&lt;/code&gt;, carrying a &lt;code&gt;BotSubscriptionUpdated&lt;/code&gt; object.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Bot API has kept moving since then:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bot API 10.3 (August 24, 2026):&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;buttons inside rich messages&lt;/li&gt;
&lt;li&gt;disabled inline buttons&lt;/li&gt;
&lt;li&gt;ephemeral-message parameters consolidated into a single &lt;code&gt;ephemeral_message_parameters&lt;/code&gt; object&lt;/li&gt;
&lt;li&gt;a native Stop button for streamed drafts&lt;/li&gt;
&lt;li&gt;a new &lt;code&gt;stopped_message_generation&lt;/code&gt; field on &lt;code&gt;Update&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bot API 10.4 (November 9, 2026):&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;HTML widgets, via &lt;code&gt;sendWidget&lt;/code&gt;, &lt;code&gt;sendSharedWidget&lt;/code&gt;, &lt;code&gt;answerWidgetQuery&lt;/code&gt;, &lt;code&gt;editMessageWidgetData&lt;/code&gt; and &lt;code&gt;editSharedWidgetData&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;TON wallet cards and transfer service messages&lt;/li&gt;
&lt;li&gt;ephemeral replies triggered by button presses&lt;/li&gt;
&lt;li&gt;according to library release notes, new &lt;code&gt;widget_query&lt;/code&gt; and &lt;code&gt;shared_widget_query&lt;/code&gt; update types&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of the 10.2–10.4 announcements change how &lt;code&gt;setWebhook&lt;/code&gt; or the secret-token header work. The &lt;code&gt;Update&lt;/code&gt; object keeps gaining top-level fields, which is why Step 3 matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why localhost does not work for Telegram webhooks
&lt;/h2&gt;

&lt;p&gt;A webhook is an outgoing HTTPS POST from Telegram’s servers to your URL. Telegram cannot reach &lt;code&gt;http://localhost:3000&lt;/code&gt;, so you need a public HTTPS endpoint that forwards to your machine. Telegram’s documented requirements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The URL must be &lt;strong&gt;HTTPS&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Supported webhook ports are &lt;strong&gt;443, 80, 88 and 8443&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;While a webhook is set, you &lt;strong&gt;cannot&lt;/strong&gt; receive updates through &lt;code&gt;getUpdates&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A self-signed certificate requires uploading the public certificate through the &lt;code&gt;certificate&lt;/code&gt; parameter, which is rarely worth it in development.&lt;/li&gt;
&lt;li&gt;Per Hookdeck’s summary of Telegram’s webhook guide, delivery is IPv4-only and needs TLS 1.2 or later.&lt;/li&gt;
&lt;li&gt;Undelivered updates are not stored for longer than 24 hours.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A tunnel satisfies all of this at once. It gives you a public hostname with a valid certificate on port 443 and forwards traffic to a local port such as 3000.&lt;/p&gt;

&lt;p&gt;There is one exception for the bot side only. If you run the open-source &lt;code&gt;telegram-bot-api&lt;/code&gt; server locally, Telegram documents that your bot can use an HTTP webhook URL, any local IP address and any port. That removes the tunnel for webhook delivery. It does not make a Mini App reachable from a phone, because the Telegram client still has to load the Mini App URL.&lt;/p&gt;

&lt;p&gt;Each bot has exactly one webhook URL. Calling &lt;code&gt;setWebhook&lt;/code&gt; again replaces it. Use a separate development bot, created through BotFather, so your experiments never redirect production traffic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Register the webhook with setWebhook
&lt;/h2&gt;

&lt;p&gt;Start your local server, start your tunnel, then register the public URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST &lt;span class="s2"&gt;"https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/setWebhook"&lt;/span&gt; \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{
    "url": "https://your-subdomain.example.com/telegram/webhook",
    "secret_token": "'&lt;/span&gt;&lt;span class="s2"&gt;"$TELEGRAM_WEBHOOK_SECRET"&lt;/span&gt;&lt;span class="s1"&gt;'",
    "allowed_updates": ["message", "callback_query"],
    "drop_pending_updates": true
  }'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The parameters you will actually use:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Parameter&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;url&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;HTTPS URL that receives one JSON-serialized &lt;code&gt;Update&lt;/code&gt; per POST. An empty string removes the webhook.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;secret_token&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Secret echoed back to you in a header on every request. 1–256 characters.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;allowed_updates&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Update types to receive. An empty list means all types except &lt;code&gt;chat_member&lt;/code&gt;, &lt;code&gt;message_reaction&lt;/code&gt; and &lt;code&gt;message_reaction_count&lt;/code&gt;. If omitted, the previous setting is kept.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;max_connections&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Maximum simultaneous HTTPS connections for delivery, 1–100, default 40.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;drop_pending_updates&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Discards the backlog, useful when you move a bot to a new URL.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ip_address&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fixed IP to use instead of resolving DNS.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;certificate&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Public certificate (uploaded as a file) for self-signed setups.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two habits save time in development:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;drop_pending_updates&lt;/code&gt; when you change URLs, so your local server is not flooded with stale messages.&lt;/li&gt;
&lt;li&gt;Call &lt;code&gt;getWebhookInfo&lt;/code&gt; whenever deliveries stop. It reports the current URL, &lt;code&gt;pending_update_count&lt;/code&gt;, &lt;code&gt;last_error_date&lt;/code&gt;, &lt;code&gt;last_error_message&lt;/code&gt; and the active &lt;code&gt;allowed_updates&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An &lt;code&gt;allowed_updates&lt;/code&gt; change does not apply to updates that were created before the call, so a few unwanted updates can still arrive.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="s2"&gt;"https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/getWebhookInfo"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To return to polling, call &lt;code&gt;deleteWebhook&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Verify the secret-token header
&lt;/h2&gt;

&lt;p&gt;If you pass &lt;code&gt;secret_token&lt;/code&gt; to &lt;code&gt;setWebhook&lt;/code&gt;, Telegram includes it in every webhook request in the &lt;strong&gt;&lt;code&gt;X-Telegram-Bot-Api-Secret-Token&lt;/code&gt;&lt;/strong&gt; header. The token must be 1 to 256 characters, using only &lt;code&gt;A-Z&lt;/code&gt;, &lt;code&gt;a-z&lt;/code&gt;, &lt;code&gt;0-9&lt;/code&gt;, &lt;code&gt;_&lt;/code&gt; and &lt;code&gt;-&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This matters because your tunnel URL is public. Without a secret, anyone who discovers the URL can POST forged updates, and nothing in the request identifies Telegram. If you set no token, Telegram sends no header at all.&lt;/p&gt;

&lt;p&gt;The mechanism is a &lt;strong&gt;shared secret, not a signature&lt;/strong&gt;. Nothing is computed over the body, so a leaked secret lets an attacker forge requests until you rotate it. Rotation is simple: call &lt;code&gt;setWebhook&lt;/code&gt; again with a new value. Hookdeck’s guide also lists Telegram’s published source ranges (&lt;code&gt;149.154.160.0/20&lt;/code&gt; and &lt;code&gt;91.108.4.0/22&lt;/code&gt;) as an optional second layer, and notes that they may change.&lt;/p&gt;

&lt;p&gt;A minimal Express handler:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"express"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;crypto&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"node:crypto"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;SECRET&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;TELEGRAM_WEBHOOK_SECRET&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="no"&gt;SECRET&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"TELEGRAM_WEBHOOK_SECRET is not set"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;secretMatches&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;received&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;received&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;SECRET&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timingSafeEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/telegram/webhook"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;secretMatches&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"x-telegram-bot-api-secret-token"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;401&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// acknowledge, then process&lt;/span&gt;
  &lt;span class="nf"&gt;handleUpdate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three details are worth copying:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The comparison is constant-time.&lt;/li&gt;
&lt;li&gt;The check runs before any logic touches the body.&lt;/li&gt;
&lt;li&gt;The handler fails closed if the secret is not configured.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Telegram does not publish a response timeout, so don’t let delivery depend on slow work. Persist or queue the update first, return 200, then process. If you return 200 and then crash, the update is gone, so store it before you acknowledge.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Tolerate unknown fields so Telegram does not retry
&lt;/h2&gt;

&lt;p&gt;Telegram treats any response other than a 2xx as a failed delivery. It repeats the request and gives up after what it calls a “reasonable amount of attempts”, without publishing a schedule. That has a sharp consequence for strict parsers. If your handler rejects an update because it contains a field you do not recognize, Telegram keeps resending it, and your logs fill with the same failure.&lt;/p&gt;

&lt;p&gt;An &lt;code&gt;Update&lt;/code&gt; contains &lt;code&gt;update_id&lt;/code&gt; plus at most one other field, and the set of those fields keeps growing: &lt;code&gt;managed_bot&lt;/code&gt;, &lt;code&gt;guest_message&lt;/code&gt;, &lt;code&gt;subscription&lt;/code&gt;, &lt;code&gt;stopped_message_generation&lt;/code&gt; and, in 10.4, widget queries. A decoder that fails on unexpected keys can start returning errors even though nothing is wrong with your bot. Practical rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Parse the fields you know and ignore the rest.&lt;/strong&gt; In TypeScript with Zod, avoid &lt;code&gt;.strict()&lt;/code&gt; on webhook schemas. In Go, avoid &lt;code&gt;DisallowUnknownFields&lt;/code&gt; on the decoder. In Rust with serde, do not add &lt;code&gt;deny_unknown_fields&lt;/code&gt; to Telegram types.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Return 200 for updates you do not handle.&lt;/strong&gt; An unsupported update is not an error.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Log unknown update kinds&lt;/strong&gt; at a low level, so you notice new features without breaking delivery.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deduplicate on &lt;code&gt;update_id&lt;/code&gt;.&lt;/strong&gt; Telegram documents it as the way to ignore repeated updates and restore order. After a week with no updates, the next ID is chosen at random instead of sequentially, so don’t rely on it being consecutive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pin your Telegram library&lt;/strong&gt; and read its release notes before upgrading. Libraries differ in how quickly they cover new Bot API versions, and some silently drop update types they don’t know.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleUpdate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;update&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;update&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;onMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;update&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;update&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;callback_query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;onCallback&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;update&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;callback_query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;update&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="s2"&gt;"update_id"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;info&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"unhandled update kind:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;kind&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use &lt;code&gt;allowed_updates&lt;/code&gt; as a second layer. Subscribing only to the types you handle keeps unrelated events from arriving at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Serve a Mini App from localhost
&lt;/h2&gt;

&lt;p&gt;A Mini App is a web page that runs inside Telegram’s in-app browser and talks to the client through &lt;code&gt;window.Telegram.WebApp&lt;/code&gt;. In development you point it at your tunnel URL:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run your frontend dev server on a local port.&lt;/li&gt;
&lt;li&gt;Start the tunnel and note the public HTTPS hostname.&lt;/li&gt;
&lt;li&gt;Set that URL wherever your Mini App is launched from. Telegram documents several routes: a &lt;code&gt;web_app&lt;/code&gt; inline or keyboard button, the bot menu button (BotFather’s &lt;code&gt;/setmenubutton&lt;/code&gt; or Bot Settings → Menu Button), the bot’s Main Mini App in BotFather, and direct links in the form &lt;code&gt;https://t.me/botusername/appname&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Open the bot inside Telegram and launch the Mini App.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Keep the hostname identical everywhere it appears. The origin check below makes that more than tidiness.&lt;/p&gt;

&lt;p&gt;Production Mini Apps are served over HTTPS, which any tunnel provides. Telegram’s separate &lt;strong&gt;test environment&lt;/strong&gt; is the exception. It uses its own account and its own bot, and its docs allow plain HTTP Mini App links there. You call it through &lt;code&gt;https://api.telegram.org/bot&amp;lt;token&amp;gt;/test/METHOD_NAME&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Two framework gotchas come up repeatedly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Host checks.&lt;/strong&gt; Vite’s dev server answers only requests whose &lt;code&gt;Host&lt;/code&gt; header is &lt;code&gt;localhost&lt;/code&gt;, a &lt;code&gt;.localhost&lt;/code&gt; subdomain or an IP address. Otherwise it returns “Blocked request. This host is not allowed.” Add your tunnel hostname to &lt;code&gt;server.allowedHosts&lt;/code&gt;. A leading dot matches subdomains. Don’t set &lt;code&gt;allowedHosts: true&lt;/code&gt;, because that accepts any &lt;code&gt;Host&lt;/code&gt; header and opens the dev server to DNS rebinding.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hot reload.&lt;/strong&gt; The HMR WebSocket has to pass through the tunnel too. Behind an HTTPS tunnel you may need &lt;code&gt;server.hmr.clientPort&lt;/code&gt; set to 443. Strapi’s guide suggests this, but test it on your setup.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To debug inside the Telegram client, Telegram documents these options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;iOS:&lt;/strong&gt; tap the Settings icon 10 times and enable &lt;em&gt;Allow Web View Inspection&lt;/em&gt;, then use Safari’s Develop menu.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Android:&lt;/strong&gt; enable &lt;em&gt;WebView Debug&lt;/em&gt; in Telegram’s debug settings, then open &lt;code&gt;chrome://inspect/#devices&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Desktop:&lt;/strong&gt; the Windows/Linux beta has experimental webview inspection, and the macOS beta has a “Debug Mini Apps” option.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Validate initData on your server
&lt;/h3&gt;

&lt;p&gt;When the Mini App opens, &lt;code&gt;window.Telegram.WebApp.initData&lt;/code&gt; contains a signed query string. It is empty if the Mini App was launched from a keyboard button or from inline mode. Never trust &lt;code&gt;initDataUnsafe&lt;/code&gt; or any user object on the client. Send the raw string to your backend and verify it with Telegram’s documented algorithm:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Remove the &lt;code&gt;hash&lt;/code&gt; field. Leave every other received field in, including &lt;code&gt;signature&lt;/code&gt;, which exists for third-party verification.&lt;/li&gt;
&lt;li&gt;Sort the remaining &lt;code&gt;key=value&lt;/code&gt; pairs by key and join them with line feeds (&lt;code&gt;\n&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Compute a secret key: HMAC-SHA256 of the bot token, using the constant string &lt;code&gt;WebAppData&lt;/code&gt; as the key.&lt;/li&gt;
&lt;li&gt;Compute the HMAC-SHA256 of the data-check-string with that secret key, as hex.&lt;/li&gt;
&lt;li&gt;Compare it to &lt;code&gt;hash&lt;/code&gt; in constant time, and reject stale &lt;code&gt;auth_date&lt;/code&gt; values.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;crypto&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"node:crypto"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;verifyInitData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;initData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;botToken&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;maxAgeSeconds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3600&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;URLSearchParams&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;initData&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;hash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"hash"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"hash"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;checkString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;entries&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="sb"&gt;`${k}=${v}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"\n"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;secret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createHmac&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"sha256"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"WebAppData"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;botToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;expected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createHmac&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"sha256"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;checkString&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;digest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"hex"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;valid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="n"&gt;hash&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
    &lt;span class="n"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
    &lt;span class="n"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;timingSafeEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hash&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Buffer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;expected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;fresh&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"auth_date"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;maxAgeSeconds&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Boolean&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;valid&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;fresh&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Telegram only says to check &lt;code&gt;auth_date&lt;/code&gt; to avoid outdated data. The one-hour window is your choice. If a third party needs to validate the data without your bot token, Telegram provides an Ed25519 &lt;code&gt;signature&lt;/code&gt; flow that uses your bot’s numeric ID and Telegram’s public keys.&lt;/p&gt;

&lt;h2&gt;
  
  
  The new Mini App origin check, explained
&lt;/h2&gt;

&lt;p&gt;Before July 20, 2026, any page opened inside your Mini App’s webview could call &lt;code&gt;Telegram.WebApp.*&lt;/code&gt; methods such as &lt;code&gt;close()&lt;/code&gt;, &lt;code&gt;expand()&lt;/code&gt;, the main button or &lt;code&gt;sendData()&lt;/code&gt;. Now those calls are allowed only from the Mini App’s own domain. Telegram’s changelog calls it the “original Mini App domain”. Third-party documentation describes it as the domain registered in BotFather.&lt;/p&gt;

&lt;p&gt;What this means in practice, per Leadgram’s write-up of the change:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pages on the Mini App’s domain&lt;/strong&gt; keep working.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pages on another domain&lt;/strong&gt; opened inside the Mini App, such as an offer page, a payment page or an auth page, can no longer call Mini App methods. AdsGram’s write-up also flags iframe-based and multi-domain setups as affected.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Everything else still works.&lt;/strong&gt; Third-party pages still open in the webview, and ordinary links, HTTP redirects, &lt;code&gt;t.me&lt;/code&gt; links and server-side calls are unaffected. Exactly one thing is blocked: calling Telegram’s Mini App methods from a foreign domain. Plain &lt;code&gt;fetch&lt;/code&gt; calls from your page to a separate API domain are a different matter.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The registered domain must be the real one.&lt;/strong&gt; Leadgram warns that if your Mini App URL points at a redirect, tracker or shortener, the Mini App ends up registered on that domain. Your real domain’s Telegram calls are then blocked. Point the registration at the final destination.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What it means for localhost and tunnels
&lt;/h3&gt;

&lt;p&gt;The rule is about hostnames. These consequences follow from it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Random, rotating URLs&lt;/strong&gt; mean the hostname serving your page changes while the one you registered stays old. Expect Mini App methods to fail until you update it everywhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A stable subdomain&lt;/strong&gt; lets you register the Mini App origin once. The URL in BotFather, the one your frontend runs on and the one in your webhook all stay the same across restarts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Split environments&lt;/strong&gt; deserve separate hostnames, ideally with a separate dev bot for each. Keep every page that calls &lt;code&gt;Telegram.WebApp&lt;/code&gt; on the registered domain.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A debugging checklist for when a Mini App method suddenly stops working in development:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Compare the page’s origin with the URL you registered. Are they identical, including the subdomain?&lt;/li&gt;
&lt;li&gt;Check for an intermediate redirect between the registered URL and the page.&lt;/li&gt;
&lt;li&gt;Search your code for &lt;code&gt;Telegram.WebApp&lt;/code&gt; and check which domains serve those pages. Leadgram suggests walking the user’s path in Telegram Desktop or web.telegram.org with DevTools open.&lt;/li&gt;
&lt;li&gt;Look for iframes or navigations to other domains, such as auth providers or payment pages.&lt;/li&gt;
&lt;li&gt;Confirm the tunnel hostname did not change since you last registered it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If a foreign page only calls &lt;code&gt;close()&lt;/code&gt; or &lt;code&gt;openLink()&lt;/code&gt;, Leadgram’s suggested fix is replacing the call with an ordinary &lt;code&gt;https://t.me/...&lt;/code&gt; link or a redirect.&lt;/p&gt;

&lt;h3&gt;
  
  
  Should you opt out?
&lt;/h3&gt;

&lt;p&gt;The BotFather Mini App lets you disable the protection, but Telegram’s wording is a warning: by doing so you take responsibility for ensuring the Mini App links to no untrusted sites. Opting out restores the old behavior, where any page inside the webview can drive the app, which is exactly the hole Telegram closed. Opting out to make a development setup work is the wrong fix when the real problem is an origin mismatch. Fix the mismatch, keep the protection on, and reserve opt-out for cases where you fully control every page the Mini App can navigate to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing a tunnel: why a stable subdomain is the practical answer
&lt;/h2&gt;

&lt;p&gt;Every piece of Telegram configuration in this article is keyed to a URL: the webhook endpoint, the Mini App domain, and the origin Telegram compares against when a page calls a Mini App method. When the URL changes on every restart, you re-register all three each time. One forgotten update produces confusing symptoms, such as silent webhooks or Mini App methods that worked yesterday failing today.&lt;/p&gt;

&lt;p&gt;What the documented free options give you:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Hostname&lt;/th&gt;
&lt;th&gt;Notes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ngrok Free&lt;/td&gt;
&lt;td&gt;One assigned dev domain per account that does not change when you restart the agent&lt;/td&gt;
&lt;td&gt;Limits per ngrok’s docs: 1 GB data transfer out and 20,000 HTTP requests per month, up to 3 online endpoints. Free endpoints have no timeout.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cloudflare Quick Tunnel&lt;/td&gt;
&lt;td&gt;Random &lt;code&gt;trycloudflare.com&lt;/code&gt; hostname each run&lt;/td&gt;
&lt;td&gt;No account needed, but Cloudflare labels it testing-only, with a 200 concurrent request limit and no Server-Sent Events.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cloudflare named tunnel&lt;/td&gt;
&lt;td&gt;A hostname you choose on your own domain&lt;/td&gt;
&lt;td&gt;Requires a Cloudflare account and a domain.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Mind the ngrok interstitial. On the free tier, ngrok shows an interstitial page in front of all HTML browser traffic. ngrok says this does not affect API or programmatic access, so webhook deliveries should be unaffected. A Mini App page loaded in Telegram’s webview is HTML browser traffic, so users may see the warning page. ngrok documents two ways to remove it: upgrade to any paid plan, or have the client send a skip header or a non-standard &lt;code&gt;User-Agent&lt;/code&gt;. The header route is awkward for a page that Telegram’s webview loads.&lt;/p&gt;

&lt;p&gt;Other tunneling services offer stable subdomains on free or paid tiers. Check your provider’s current terms for subdomain persistence, session length and browser-warning pages before you depend on them.&lt;/p&gt;

&lt;h3&gt;
  
  
  A setup checklist
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create a dedicated development bot in BotFather.&lt;/li&gt;
&lt;li&gt;Pick a tunnel with a stable hostname, and use that hostname for both the webhook and the Mini App.&lt;/li&gt;
&lt;li&gt;Call &lt;code&gt;setWebhook&lt;/code&gt; once, with a &lt;code&gt;secret_token&lt;/code&gt; and a narrow &lt;code&gt;allowed_updates&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Register the Mini App URL on the same hostname. Avoid redirects.&lt;/li&gt;
&lt;li&gt;Allow the hostname in your dev server’s host check.&lt;/li&gt;
&lt;li&gt;Verify the secret-token header and &lt;code&gt;initData&lt;/code&gt; server-side.&lt;/li&gt;
&lt;li&gt;Ignore and log unknown update fields, and deduplicate on &lt;code&gt;update_id&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;When deliveries stop, check &lt;code&gt;getWebhookInfo&lt;/code&gt; first.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Which ports can Telegram send webhooks to?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
443, 80, 88 and 8443. A tunnel exposes port 443 and forwards to whatever local port you use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What happens if my webhook returns an error?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Telegram treats non-2xx responses as failures and retries, giving up after “a reasonable amount of attempts”. An endpoint that errors on unexpected input can cause repeated deliveries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I skip the tunnel and use getUpdates?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
For bot logic, yes, as long as no webhook is set. A Mini App still needs a URL the Telegram client can load, so it needs a public HTTPS hostname. The exceptions are the test environment and a local Bot API server, which only covers the bot side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is the secret token mandatory?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
No, but without it nothing in a request identifies Telegram, and anyone who finds your tunnel URL can send forged updates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is Bot API 10.2 the latest version?&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
No. Bot API 10.3 (August 24, 2026) and 10.4 (November 9, 2026) have been released since. The webhook and Mini App origin behavior described here still applies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://core.telegram.org/bots/api-changelog" rel="noopener noreferrer"&gt;Telegram Bot API changelog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://core.telegram.org/bots/api#setwebhook" rel="noopener noreferrer"&gt;Telegram Bot API reference: setWebhook, getWebhookInfo, Update, local Bot API server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://core.telegram.org/bots/webapps" rel="noopener noreferrer"&gt;Telegram Mini Apps documentation: initData validation, testing, debugging&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://t.me/s/botnews" rel="noopener noreferrer"&gt;BotNews channel on Telegram (10.2 origin warning, 10.3 and 10.4 announcements)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/unifyport/telegram-bot-api-102-migration-guide-rich-messages-ephemeral-edits-and-communities-gfe"&gt;Telegram Bot API 10.2 migration guide, DEV Community&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hookdeck.com/webhooks/platforms/guide-to-telegram-webhooks-features-and-best-practices" rel="noopener noreferrer"&gt;Guide to Telegram webhooks, Hookdeck&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://leadgram.org/en/docs/mini-app-origin-lockdown" rel="noopener noreferrer"&gt;Mini App origin lockdown, Leadgram docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://adsgram.ai/blog/adsgram/telegram-mini-app-tma-development-mistakes-and-how-to-avoid-them" rel="noopener noreferrer"&gt;Telegram Mini App development mistakes, AdsGram&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/go-telegram/bot/pull/309" rel="noopener noreferrer"&gt;go-telegram/bot Bot API 10.4 support (widget update types)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ngrok.com/docs/pricing-limits/free-plan-limits" rel="noopener noreferrer"&gt;ngrok free plan limits&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/do-more-with-tunnels/trycloudflare/" rel="noopener noreferrer"&gt;Cloudflare Quick Tunnels&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.cloudflare.com/tunnel/get-started/index.md" rel="noopener noreferrer"&gt;Cloudflare Tunnel getting started (quick tunnel limits)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://quasar.dev/quasar-cli-vite/opening-dev-server-to-public.md" rel="noopener noreferrer"&gt;Opening your dev server to the public, Quasar&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://strapi.io/blog/strapi-vite-allowed-hosts-blocked-request" rel="noopener noreferrer"&gt;Fixing “Blocked request” in Strapi 5 (HMR clientPort)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://instatunnel.my/blog/telegram-bots-and-mini-apps-on-localhost-setwebhook-the-secret-token-header-and-the-new-origin-check" rel="noopener noreferrer"&gt;https://instatunnel.my/blog/telegram-bots-and-mini-apps-on-localhost-setwebhook-the-secret-token-header-and-the-new-origin-check&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>networking</category>
    </item>
  </channel>
</rss>
