When a Shopify embedded app shows “refused to connect” in the admin, the browser has declined to display a document in the app’s iframe. The hostname in the message belongs to that document. If it is your app’s host, your response forbids framing or nothing answered. If it is admin.shopify.com, your app pointed its own frame at a Shopify page.
What follows was observed on 2 December 2026 unless a link says it came from documentation. Local Node servers stood in for the admin and the app. The browsers were the Chromium 149, Firefox 151 and WebKit 26.5 builds that Playwright 1.61.1 drives, with the main cases repeated on Playwright 1.65.1’s Chromium 159, Firefox 159 and WebKit 27.2. We also called @shopify/shopify-app-react-router 4.0.5 and 3.0.2 directly. None of it ran inside a real Shopify admin.
What does “refused to connect” mean for a Shopify embedded app?
It does not say which of three failures you have. The wording is Chromium’s, and its error page in the frame read localhost refused to connect. for all of them: a response carrying X-Frame-Options, a response whose frame-ancestors policy did not list the parent page, and a port with nothing listening on it. Playwright’s Firefox build said more in the frame itself, “Can’t Open This Page” for a frame-ancestors block and “Unable to connect” for the dead port. WebKit left the frame blank.
In Chromium the console tells them apart. For the two header failures the request ended in net::ERR_BLOCKED_BY_RESPONSE and Chromium logged one of these (port numbers changed to 3000):
Refused to display 'http://localhost:3000/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
Framing 'http://localhost:3000/' violates the following Content Security Policy directive: "frame-ancestors 'self'". The request has been blocked.
With nothing listening there was neither line, only net::ERR_CONNECTION_REFUSED on the request. If that is what you have, nothing is answering at your app URL and no header change will fix it.
The hostname narrows it further. When our stand-in app answered with a 302 to a page on another host, and that page sent X-Frame-Options: DENY, the message named the second host.
Which header blocked the frame?
| What you see | What happened | What to change |
|---|---|---|
Your app’s host, and the console names X-Frame-Options | A layer added that header and no enforced frame-ancestors policy came with it | Send the per-shop policy below and remove the header where it is added |
Your app’s host, and the console quotes a frame-ancestors directive | The quoted policy does not admit the admin: 'self', 'none' or another shop | Correct that policy in the layer that sent it |
Your app’s host, no such line, ERR_CONNECTION_REFUSED | Nothing is listening at the app URL | Start the server or correct the URL |
admin.shopify.com | Your app sent its frame to an admin page | Open that page in the top window (last section) |
Shopify’s iframe protection guide gives the browser check: open the app with the Network tab showing, filter by Doc, and read the response headers on the last document. To read the same headers without a browser, put that document’s URL in APP_URL:
curl -s -o /dev/null -D - "$APP_URL" | grep -i -E '^(HTTP|location|x-frame-options|content-security-policy)'
Count the content-security-policy lines. Two policies are both enforced, so a correct one sent beside frame-ancestors 'self' was still refused in every engine we ran. The second policy can come from security middleware or a proxy. Helmet 8.3.0 with its defaults sent X-Frame-Options: SAMEORIGIN and a policy containing frame-ancestors 'self'.
A stray X-Frame-Options does not block the frame once the right policy is in place. The CSP specification says an enforced frame-ancestors directive overrides it, and all three engines loaded a frame whose response had a matching frame-ancestors next to X-Frame-Options: DENY. A Content-Security-Policy-Report-Only header did not have that effect. Neither does a <meta> tag: each engine logged that frame-ancestors is ignored there, which our post on Content Security Policy nonces traces to the specification.
What should frame-ancestors be for an app in the Shopify admin?
The guide’s answer is the authenticated shop’s domain plus https://admin.shopify.com, on every route that renders HTML, with a value that differs for every shop:
Content-Security-Policy: frame-ancestors https://shopify-dev.myshopify.com https://admin.shopify.com;
Apps built from the React Router template get it from addDocumentResponseHeaders(request, responseHeaders) in entry.server.tsx. We called that function on its own to see what it writes and when.
It takes the shop from the ?shop= query parameter. Given a *.myshopify.com value it set a policy naming that shop, https://admin.shopify.com and three further origins the library hard-codes. Given no shop, or a value that is not a myshopify.com domain, it set no policy at all. With no policy, nothing overrides a leftover X-Frame-Options. We served the parent page as https://admin.shopify.com through request interception, so no request reached Shopify, and had the app server add X-Frame-Options: SAMEORIGIN. The app route loaded with ?shop= and was refused without it. If your app breaks only on some page loads, check whether those lose the query string.
It writes with headers.set. A Content-Security-Policy set before the call was replaced, and one you set afterwards replaces Shopify’s in turn. Add your own directives with append: a second policy holding only script-src left the frame loading.
And with distribution: AppDistribution.ShopifyAdmin it sent frame-ancestors 'none' whatever the shop. That setting is for merchant custom apps, which Shopify’s authenticate.admin reference says cannot be embedded.
A wildcard would make the error go away, and Shopify treats one as a fault. Shopify’s STATIC_FRAME_ANCESTORS check counts *, https: and https://*.myshopify.com as permissive, and the guide says App Store review rejects an app whose directive is missing or set incorrectly.
Why does it say admin.shopify.com refused to connect?
Because your app loaded an admin page in its own frame, and the admin does not appear to allow that. A logged-out request to https://admin.shopify.com/ on 2 December 2026 came back with X-Frame-Options: DENY. We could not check a logged-in page. Anything that points your iframe there ends in the same error: a plain link, or a loader that returns React Router’s own redirect() to an admin URL, which is a 302 the frame follows.
The page has to open in the top window. In markup, Shopify’s Navigation API page uses <a href="shopify://admin/products" target="_top">. On the server, use the redirect that authenticate.admin hands back:
import type { LoaderFunctionArgs } from "react-router";
import { authenticate } from "../shopify.server";
export const loader = async ({ request }: LoaderFunctionArgs) => {
const { redirect } = await authenticate.admin(request);
return redirect("shopify://admin/products", { target: "_top" });
};
Run against 4.0.5 and 3.0.2, that loader produced no 302. It produced a 200 page holding the App Bridge script tag and window.open("https://admin.shopify.com/store/demo-shop/products", "_top"). Leave target off a shopify://admin URL and it defaulted to _parent. A path inside the app stayed a 302 with shop, host and embedded copied onto it, which also keeps the ?shop= the header function depends on.
What App Bridge does with that window.open call we could not run outside a real admin. In our stand-in, a clicked target="_top" link did take the top window to the DENY page, where it loaded normally. A confirmationUrl from the Billing API is an admin URL as well (the library’s source places it under the shop’s /admin), so we would send the merchant to it the same way.
What we would do
Read the hostname first, then the console line, then the headers on the last document request, and change whichever layer sent the header the console named. We would not take either shortcut, a wildcard policy or no policy. With neither a policy nor X-Frame-Options, our stand-in app loaded inside an unrelated site’s frame too.
The exception is an app that should not be in the admin at all. For that the guide’s instruction is embedded = false in shopify.app.toml and frame-ancestors 'none', and “refused to connect” in a frame is then the correct result.
We build and run an app of our own on the Shopify App Store, and for clients we add the features Shopify leaves out and connect stores to the systems around them. If an embedded app of yours is stuck behind this error, our Shopify development work is where to start.