Wildcard Proxyのロゴ

Wildcard Proxy

コミュニティ
koolamusic
wildcard-proxy

Set up Caddy on a server so any local port is reachable at https://<port>.<domain>/, and two-letter or named labels like https://ui.<domain>/ map to ports too, with certificates issued on demand and gated so only routed hostnames get one. Use when the user says 'set up the wildcard proxy', 'port routing on this server', 'configure caddy so ports get subdomains', 'add a short name for port N', 'what port is ab', or is preparing a new server to expose local services by port.

概要

公開者koolamusic
リポジトリclaudefiles
スキル名wildcard-proxy
スター
121
フォーク
14
同梱ファイル
2
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 2個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    koolamusicがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルWildcard ProxyをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/koolamusic/claudefiles/tree/main/skills/wildcard-proxy
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/koolamusic/claudefiles.git /tmp/claudefiles
mkdir -p .claude/skills
cp -r /tmp/claudefiles/skills/wildcard-proxy .claude/skills/wildcard-proxy
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでWildcard Proxyを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にWildcard Proxyを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Wildcard Proxyは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Wildcard Proxy

One Caddy config, installed once per server, that routes https://<label>.<domain>/ to 127.0.0.1:<port>. After install, exposing a service is just binding it to a loopback port. A short name is one line in a names file.

How a label becomes a port

Checked in this order; first match wins.

LabelRuleExample
short namelisted in wildcard-proxy.namesui → 4001
port numbermatches the allowed port regex4012 → 4012
any two letters1 + two-digit alphabet position of each letter (a=00 … z=25)ab → 10001, hz → 10725, zz → 12525

The computed range is 10000–12525. Port for letters xy = 10000 + 100·pos(x) + pos(y). A short name overrides that name's computed port: ui would otherwise be 12008.

Anything else (abc, a1, 3000 outside the ranges, deeper subdomains) gets no certificate and no route.

Inputs

PlaceholderMeaningDefault
{{DOMAIN}}the wildcard parent, e.g. host.example.netask the user
{{DOMAIN_RE}}same, dots escapedderived
{{PORT_RE}}allowed numeric labels, as regex alternatives40[0-9][0-9]|80[0-9][0-9] (4000–4099, 8000–8099)
{{ASK_PORT}}loopback port for the certificate gate5555

Use [0-9][0-9], not [0-9]{2}, in PORT_RE. Caddyfile braces look like placeholders.

Prerequisites — check before installing

  1. Caddy v2 installed and running as a systemd service: caddy version, systemctl is-active caddy.

  2. Wildcard DNS: *.{{DOMAIN}} resolves to this server. Check with a label nobody has used: dig +short zq.{{DOMAIN}} should print the server's public IP (curl -4 -s ifconfig.me; also check dig +short AAAA if the server has IPv6).

  3. Ports 80 and 443 reachable from the internet and not held by another server: sudo ss -tlnp '( sport = :80 or sport = :443 )'.

  4. No other on_demand_tls block in /etc/caddy/Caddyfile. Caddy allows one ask endpoint. If one exists, stop and ask the user. Merging two gates is a design decision. The exception is an older inline version of this same config: replace it with the import, and keep the static sites.

  5. ASK_PORT free: ss -tln | grep ':{{ASK_PORT}} ' prints nothing, or only Caddy itself when migrating an older version of this config.

  6. Nothing private already listening on a routable port. After install, anything bound to loopback on a routed port is public. Before install, list what is already there:

    bash
    ss -tlnp | awk 'NR>1{n=split($4,a,":"); p=a[n]; if ((p>=4000&&p<=4099)||(p>=8000&&p<=8099)||(p>=10000&&p<=12525&&p%100<=25&&int(p/100)%100<=25)) print $4, $6}'

    Show the user every hit and confirm each one is meant to be public. Default ports in the computed range include memcached's 11211 (ml) and Webmin's 10000 (aa).

Install

Templates are in references/ beside this file.

1. Back up the live config.

bash
sudo cp /etc/caddy/Caddyfile /etc/caddy/Caddyfile.bak-$(date +%F)

2. Render the site file. From this skill's references/ directory:

bash
DOMAIN=host.example.net
DOMAIN_RE=$(printf '%s' "$DOMAIN" | sed 's/\./\\\\./g')
sed -e "s/{{DOMAIN}}/$DOMAIN/g" -e "s/{{DOMAIN_RE}}/$DOMAIN_RE/g" \
    -e 's/{{PORT_RE}}/40[0-9][0-9]|80[0-9][0-9]/g' -e 's/{{ASK_PORT}}/5555/g' \
    wildcard-proxy.caddy > /tmp/wildcard-proxy.caddy

Confirm no placeholder survived: grep -c '{{' /tmp/wildcard-proxy.caddy prints 0. Confirm the regex line reads host\.example\.net, with single backslashes.

3. Place both files. Don't overwrite an existing names file. It holds the user's names.

bash
sudo install -m 644 /tmp/wildcard-proxy.caddy /etc/caddy/wildcard-proxy.caddy
sudo cp -n wildcard-proxy.names /etc/caddy/wildcard-proxy.names

4. Wire it into the main Caddyfile. The global options block must be the first thing in the file. Add the on_demand_tls lines to it, creating the block if absent, and put the import anywhere after:

{
	on_demand_tls {
		ask http://127.0.0.1:5555/ask
	}
}

import wildcard-proxy.caddy

On a fresh install, remove the packaged welcome-page :80 { … } block. It catches every plain-HTTP request.

5. Validate, then reload. Never reload an unvalidated config.

bash
sudo caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile
bash
sudo systemctl reload caddy

Verify

Gate — every routed label returns 200, everything else 403:

bash
for l in 4012 ab zz 3000 abc; do printf '%s %s\n' $l "$(curl -s -o /dev/null -w '%{http_code}' "http://127.0.0.1:5555/ask?domain=$l.$DOMAIN")"; done

Expected: 4012 200, ab 200, zz 200, 3000 403, abc 403.

Gate is loopback-only — ss -tln | grep ':5555 ' shows 127.0.0.1:5555, not *:5555.

End to end — serve something on a loopback port and fetch it publicly:

bash
python3 -m http.server 4012 --bind 127.0.0.1
bash
curl -s -o /dev/null -w '%{http_code}\n' https://4012.$DOMAIN/

200 means it works. The first request to a new hostname triggers certificate issuance and can fail once with 000. Wait a few seconds and retry once before diagnosing.

Add a short name

Append <label> <port> to /etc/caddy/wildcard-proxy.names. Labels use lowercase letters, digits, and hyphens. Then validate and reload as in install step 5. Check that the label returns 200 from the gate.

To answer "what port is xy": check the names file first, then compute 10000 + 100·pos(x) + pos(y).

Rules for services behind it

  • Bind to 127.0.0.1, never 0.0.0.0. Caddy must be the only way in. A 0.0.0.0 bind exposes the service on the raw IP without TLS.
  • Scan before picking a port: ss -tln. Don't trust a remembered list.
  • Watch for static sites that share a port. A Caddyfile entry like cloud.example.net { reverse_proxy 127.0.0.1:4040 } means 4040 is taken even though it matches the range. Grep the Caddyfile for reverse_proxy 127.0.0.1: before choosing.
  • A static site block for x.{{DOMAIN}} wins over the wildcard. That's intended, but it means the names file doesn't control that label.
  • Everything is public and unauthenticated. The hostnames are guessable. Say so once before exposing anything sensitive.

Known limits

  • Certificate rate limits. About 900 hostnames can request a certificate: 200 numeric, 676 two-letter, plus names. Anyone who knows the scheme can trigger issuance for all of them and exhaust the CA's per-domain weekly limit, which blocks new certificates until it resets. Hostnames that already have certificates keep working. The full fix is a single wildcard certificate via the DNS challenge, which needs a Caddy build with the DNS provider's module. Offer it, don't do it unasked.
  • Caddy map quirks the template works around. Do not "simplify" these away:
    • Map outputs don't expand placeholders. 1{wp_da}{wp_db} as a map output stays literal, so the computed port is built inside reverse_proxy.
    • Map converts bare numeric outputs to integers. Unquoted 01 becomes 1, so ab dials port 101. The alphabet digits stay quoted.
    • The label is extracted by a regex on the full host, not {labels.N}. Label indices shift with domain depth.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Wildcard Proxy」では何ができますか?

Set up Caddy on a server so any local port is reachable at https://<port>.<domain>/, and two-letter or named labels like https://ui.<domain>/ map to ports too, with certificates issued on demand and gated so only routed hostnames get one. Use when the user says 'set up the wildcard proxy', 'port routing on this server', 'configure caddy so ports get subdomains', 'add a short name for port N', 'what port is ab', or is preparing a new server to expose local services by port.

TypingMindでWildcard Proxyを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Wildcard Proxyはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにWildcard Proxyをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/koolamusic/claudefiles/tree/main/skills/wildcard-proxyを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Wildcard Proxyを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Wildcard Proxyは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもWildcard Proxyを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Wildcard Proxy」は無料ですか?

はい。koolamusicがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇