be72715cfec087dd42844667183406413c9f2738
deno-no-ipv4-here
Inspired by ungleich
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.
Configuration
The application uses the following environment variables:
SERVICE_DOMAIN: The domain where this service is hosted (default: "localhost")- Example:
SERVICE_DOMAIN=my-ipv6-service.example.com
- Example:
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
- Install Deno: https://deno.land/manual/getting_started/installation
- Clone this repository:
git clone https://git.kyun.li/gunter/ungleich-no-ipv4-here cd ungleich-no-ipv4-here - Start the service:
deno run --allow-net --allow-read app.ts - Set the SERVICE_DOMAIN environment variable for your domain:
SERVICE_DOMAIN=your-domain.example.com deno run --allow-net --allow-read app.ts
Running with Docker
- Build the Docker image:
docker build -t deno-no-ipv4-here . - Run the container with your domain configuration:
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:
# 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:
- Handles requests for your configured domain normally
- Redirects all other domains to the no-ipv4-here service
- Passes the original host as the
back_toparameter - Uses a permanent redirect (HTTP 301)
Replace no-ipv4-here.your-domain.example.com with the domain where you're running this service.
Description
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. `
Now in Deno
Languages
TypeScript
80.3%
Dockerfile
19.7%