# deno-no-ipv4-here *Inspired by [ungleich](https://code.ungleich.ch/ungleich-public/ungleich-no-ipv4-here)* A simple microservice that responds the following text to all requests ``` Sorry, (this part of) domain $domain is not reachable by IPv4. Please upgrade to IPv6 and try to reach $domain again. ``` Written for Deno. ## Enable for your site Simply add the A record `82.153.138.10` to your domain besides your existing AAAA record to use the version hosted by us. If you want to host it yourself, run: `docker run -d --name no-ipv4-here -e SERVICE_DOMAIN=no-ipv4-here.YOUR-DOMAIN.com -p 8080:8080 --restart unless-stopped git.kyun.li/gunter/no-ipv4-here:latest` or read on. ## Configuration The application uses the following environment variables: - `SERVICE_DOMAIN`: The domain where this service is hosted (default: "localhost") - Example: `SERVICE_DOMAIN=no-ipv4-here.example.com` When making requests to this service, the domain you provide in the `back_to` parameter will be compared against this value to determine if it should be treated as an external domain. ## Running with Deno 1. Install Deno: https://deno.land/manual/getting_started/installation 2. Clone this repository: ```bash git clone https://git.kyun.li/gunter/deno-no-ipv4-here cd deno-no-ipv4-here ``` 3. Start the service: ```bash deno run --allow-net --allow-read app.ts ``` 4. Set the SERVICE_DOMAIN environment variable for your domain: ```bash SERVICE_DOMAIN=your-domain.example.com deno run --allow-net --allow-read app.ts ``` ## Running with Docker 1. Build the Docker image: ```bash docker build -t deno-no-ipv4-here . ``` 2. Run the container with your domain configuration: ```bash docker run -e SERVICE_DOMAIN=your-domain.example.com -p 8080:8080 deno-no-ipv4-here ``` ## Example Caddy Configuration Here's a Caddyfile configuration that redirects all non-configured domains to this service: ```caddy # Caddyfile (your_domain) { # Your existing configuration for your domain reverse_proxy localhost:8080 } # Catch-all for all other domains :80, :443 { # Redirect to the no-ipv4-here service redir https://no-ipv4-here.your-domain.example.com?back_to={host} permanent } ``` This configuration: 1. Handles requests for your configured domain normally 2. Redirects all other domains to the no-ipv4-here service 3. Passes the original host as the `back_to` parameter 4. Uses a permanent redirect (HTTP 301) Replace `no-ipv4-here.your-domain.example.com` with the domain where you're running this service.