Next.js on your phone: allowedDevOrigins
Tested with Next.js 16.5.0,
Since Next.js 16.2, next dev blocks its dev resources from any origin it doesn't know, and your phone is one. On the phone, the page at http://192.168.x.x:3000 loads, but hot reload never connects, so your edits don't show up. Add the address to allowedDevOrigins in next.config and restart the dev server.
The message in your terminal
⚠ Blocked cross-origin request to Next.js dev resource /_next/hmr from "192.168.70.198".
Cross-origin access to Next.js dev resources is blocked by default for safety.
To allow this host in development, add it to "allowedDevOrigins" in next.config.js and restart the dev server:
allowedDevOrigins: ['192.168.70.198'],
Nothing shows on the phone itself: the page looks fine and stops updating. The same block can hit fonts from next/font (/__nextjs_font/…) when the page comes through a tunnel, so the phone shows a fallback font.
The fix
// next.config.ts
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
allowedDevOrigins: ['192.168.70.198'], // your computer's Wi-Fi address
};
export default nextConfig;
Restart next dev. In our test, the next edit reached the phone through hot reload, without a page reload.
- Hostnames only. No
http://and no port. - Wildcards.
*matches one label and**one or more, at the start only:'*.trycloudflare.com'covers a quick tunnel.*.example.devdoes not matchexample.devitself. - No "allow all". List the hosts you use. Your Wi-Fi address changes between networks, so you may need to update it.
- Server Actions through a tunnel have a separate list:
experimental.serverActions.allowedOrigins.
Which versions behave how
| Next.js | Requests from an unknown origin |
|---|---|
| 15.2.4 to 16.1.x | Allowed, with a warning in the terminal, unless you set allowedDevOrigins; then only the listed hosts |
| 16.2.0 and later | Blocked with 403 by default |
Next.js treats localhost, *.localhost and the host you pass with -H as allowed. You don't need -H 0.0.0.0 to reach it from the phone: next dev already listens on all addresses and prints the Network URL.
Without editing the config
Tondavo opens your dev server on the phone over HTTPS and presents the phone's requests to Next.js as coming from localhost, the way a reverse proxy does. On Next.js 16.5 the page, fonts and hot reload all worked with no allowedDevOrigins entry. The phone's traffic passes through Tondavo's edge on Cloudflare; if it must stay on your network, use allowedDevOrigins as above. Run it next to next dev:
npx tondavo 3000
To try it: npx tondavo. See Getting started.