🍊

Tailscaleで,リモートPCのviteまたはwebpack開発サーバーに簡単にアクセスしたい

に公開

結論

  1. tailscaleの設定(ポート番号は任意のものを設定)
    sudo tailscale serve --bg --https=443 3000
  2. webpack.jsonまたはvite.config.tsに以下を追加
    • webpack
      devServer: {
          host: '0.0.0.0',
          allowedHosts: 'all',
      },
      
    • vite
      server: {
          host: true, // 開発サーバをネットワーク上に公開するかどうか
          allowedHosts: ["リモートPCのホスト名"],
      },
      

https://リモートPCのホスト名にアクセスできるはずだ.

環境

リモートPC: mac mini

ローカルPC: windows11

両者にtailscaleをインストールして設定済み.

背景

リモートPCにsshしてweb開発しているときのこと.tailscaleを活用して開発サーバにhttpsでアクセスしたいだけなのに,502 Bad Gatewayを出される.

Discussion