Astro Tunnel
Astro Tunnel is an Astro Dev Toolbar App that enables your local Astro server to be accessible from the internet. Internally, it uses Cloudflare's Quick Tunnels via unjs/untun, so no additional configuration is required to start tunneling.
Installation
To install Astro Tunnel, run the following command with your preferred package manager:
npx astro add astro-tunnel
Usage
import { defineConfig } from 'astro/config';
import tunnel from 'astro-tunnel';
export default defineConfig({
integrations: [tunnel()],
});
Upon first starting a tunnel, you will be prompted to accept the terms of the Cloudflare License, Terms and Privacy Policy on the command line. Once you accept these terms, a tunnel will be initiated and a public URL for your local Astro server will be displayed inside the Dev Toolbar.
If you encounter any issues while starting a tunnel, try installing cloudflared
separately by running npx untun@latest tunnel http://localhost:3000
first. After that, you should be able to start a tunnel from within the App.
Configuration
Astro Tunnel accepts the following options:
tunnel({
url: 'http://localhost:4321',
port: 4321,
host: 'localhost',
protocol: 'http',
verifyTLS: false,
acceptCloudflareNotice: false,
});