This commit is contained in:
qrkourier 2023-12-12 02:31:00 +00:00
parent 7a99314571
commit b11d251ac5
36 changed files with 116 additions and 82 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
.env
compose.override.yml
*compose.override.yml

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">
@ -52,6 +52,9 @@
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="enable">Enable<a href="#enable" class="hash-link" aria-label="Direct link to Enable" title="Direct link to Enable"></a></h2>
<p>Save the enable token from the zrok console in the configuration file.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">/opt/openziti/etc/zrok/zrok-share.env</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">ZROK_ENABLE_TOKEN=&quot;14cbfca9772f&quot;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="name-your-share">Name your Share<a href="#name-your-share" class="hash-link" aria-label="Direct link to Name your Share" title="Direct link to Name your Share"></a></h2>
<p>This unique name becomes part of the domain name of the share, e.g. <code>https://my-prod-app.in.zrok.io</code>. A random name is generated if you don&#x27;t specify one.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">/opt/openziti/etc/zrok/zrok-share.env</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">ZROK_UNIQUE_NAME=&quot;my-prod-app&quot;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="use-cases">Use Cases<a href="#use-cases" class="hash-link" aria-label="Direct link to Use Cases" title="Direct link to Use Cases"></a></h2>
<p>You may change the target for the current backend mode, e.g. <code>proxy</code>, by editing the configuration file and restarting the service. The reserved subdomain will remain the same.</p>
<p>You may switch between backend modes or change authentication options by deleting <code>/var/lib/zrok-share/.zrok/reserved.json</code> and restarting the service. A new subdomain will be reserved.</p>
@ -105,20 +108,31 @@ target.</p>
</ol>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="create-the-docker-project">Create the Docker Project<a href="#create-the-docker-project" class="hash-link" aria-label="Direct link to Create the Docker Project" title="Direct link to Create the Docker Project"></a></h2>
<ol>
<li>Make a folder on your computer to use as a Docker Compose project for your zrok public share with a reserved subdomain and switch to the new directory in your terminal.</li>
<li>Download <a href="/zrok-public-reserved/compose.yml" target="_blank" rel="noopener noreferrer">the reserved public share <code>compose.yml</code> project file</a> into the same directory.</li>
<li>Copy your zrok account&#x27;s enable token from the zrok web console to your clipboard and paste it in a file named <code>.env</code> in the same folder like this:</li>
</ol>
<li>
<p>Make a folder on your computer to use as a Docker Compose project for your zrok public share with a reserved subdomain and switch to the new directory in your terminal.</p>
</li>
<li>
<p>Download <a href="/zrok-public-reserved/compose.yml" target="_blank" rel="noopener noreferrer">the reserved public share <code>compose.yml</code> project file</a> into the same directory.</p>
</li>
<li>
<p>Copy your zrok account&#x27;s enable token from the zrok web console to your clipboard and paste it in a file named <code>.env</code> in the same folder like this:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">.env</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">ZROK_ENABLE_TOKEN=&quot;8UL9-48rN0ua&quot;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<ol>
<li>Run the Compose project to start sharing the built-in demo web server. Be sure to <code>--detach</code> so the project runs in the background if you want it to auto-restart when your computer reboots.</li>
</ol>
</li>
<li>
<p>Name the Share</p>
<p>This unique name becomes part of the domain name of the share, e.g. <code>https://my-prod-app.in.zrok.io</code>. A random name is generated if you don&#x27;t specify one.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">.env</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">ZROK_UNIQUE_NAME=&quot;my-prod-app&quot;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
</li>
<li>
<p>Run the Compose project to start sharing the built-in demo web server. Be sure to <code>--detach</code> so the project runs in the background if you want it to auto-restart when your computer reboots.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">docker compose up --detach</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<ol>
<li>Get the public share URL from the output of the <code>zrok-share</code> service or by peeking in the zrok console where the share will appear in the graph.</li>
</ol>
</li>
<li>
<p>Get the public share URL from the output of the <code>zrok-share</code> service or by peeking in the zrok console where the share will appear in the graph.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">docker compose logs zrok-share</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="language-buttonless codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">Output</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-buttonless codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">zrok-public-share-1 | https://w6r1vesearkj.in.zrok.io/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
</li>
</ol>
<p>This concludes the minimum steps to begin sharing the demo web server. Read on to learn how to pivot to sharing any website or web service by leveraging additional zrok backend modes.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="proxy-any-web-server">Proxy Any Web Server<a href="#proxy-any-web-server" class="hash-link" aria-label="Direct link to Proxy Any Web Server" title="Direct link to Proxy Any Web Server"></a></h2>
<p>The simplest way to share your existing HTTP server is to set <code>ZROK_TARGET</code> (e.g. <code>https://example.com</code>) in the environment of the <code>docker compose up</code> command. When you restart the share will auto-configure for that URL.</p>
@ -136,27 +150,31 @@ features in <a href="https://blog.openziti.io/the-zrok-oauth-public-frontend" ta
<p>Caddy is the most powerful and flexible backend mode in zrok. You must reserve a new public subdomain whenever you switch the backend mode, so using <code>caddy</code> reduces the risk that you&#x27;ll have to share a new frontend URL with your users.</p>
<p>With Caddy, you can balance the workload for websites or web services or share static sites and files or all of the above at the same time. You can update the Caddyfile and restart the Docker Compose project to start sharing the new configuration with the same reserved public subdomain.</p>
<ol>
<li>Create a Caddyfile. This example demonstrates proxying two HTTP servers with a weighted round-robin load balancer.</li>
</ol>
<li>
<p>Create a Caddyfile. This example demonstrates proxying two HTTP servers with a weighted round-robin load balancer.</p>
<div class="language-console codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">Caddyfile</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-console codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">http:// {</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> # zrok requires this bind address template</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> bind {{ .ZrokBindAddress }}</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> reverse_proxy /* {</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> to http://httpbin1:8080 http://httpbin2:8080</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> lb_policy weighted_round_robin 3 2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<ol>
<li>Create a file <code>compose.override.yml</code>. This example adds two <code>httpbin</code> containers for load balancing, and mounts the Caddyfile into the container.</li>
</ol>
</li>
<li>
<p>Create a file <code>compose.override.yml</code>. This example adds two <code>httpbin</code> containers for load balancing, and mounts the Caddyfile into the container.</p>
<div class="language-yaml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">compose.override.yml</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-yaml codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token key atrule">services</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">httpbin1</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">image</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> mccutchen/go</span><span class="token punctuation" style="color:rgb(248, 248, 242)">-</span><span class="token plain">httpbin </span><span class="token comment" style="color:rgb(98, 114, 164)"># 8080/tcp</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">httpbin2</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">image</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> mccutchen/go</span><span class="token punctuation" style="color:rgb(248, 248, 242)">-</span><span class="token plain">httpbin </span><span class="token comment" style="color:rgb(98, 114, 164)"># 8080/tcp</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">zrok-share</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">volumes</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">-</span><span class="token plain"> ./Caddyfile</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain">/mnt/.zrok/Caddyfile</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<ol>
<li>Start a new Docker Compose project or delete the existing state volume.</li>
</ol>
</li>
<li>
<p>Start a new Docker Compose project or delete the existing state volume.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">docker compose down --volumes</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
</li>
</ol>
<p>If you prefer to keep using the same zrok environment with the new share then delete <code>/mnt/.zrok/reserved.json</code> instead of the entire volume.</p>
<ol>
<li>Run the project to load the new configuration.</li>
</ol>
<li>
<p>Run the project to load the new configuration.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">docker compose up --detach</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<ol>
<li>Note the new reserved share URL from the log.</li>
</ol>
</li>
<li>
<p>Note the new reserved share URL from the log.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">docker compose logs zrok-share</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="language-buttonless codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">Output</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-buttonless codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">INFO: zrok public URL: https://88s803f2qvao.in.zrok.io/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>On Windows, zrok frontdoor is implemented as a Docker Compose project which reserves a public subdomain for your website or service.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="goal">Goal<a href="#goal" class="hash-link" aria-label="Direct link to Goal" title="Direct link to Goal"></a></h2>
<div class="language-buttonless codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">Output</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-buttonless codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">INFO: zrok public URL: https://88s803f2qvao.in.zrok.io/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
</li>
</ol></div><div role="tabpanel" class="tabItem_Ymn6" hidden=""><p>On Windows, zrok frontdoor is implemented as a Docker Compose project which reserves a public subdomain for your website or service.</p><h2 class="anchor anchorWithStickyNavbar_LWe7" id="goal">Goal<a href="#goal" class="hash-link" aria-label="Direct link to Goal" title="Direct link to Goal"></a></h2>
<p>Proxy a reserved public subdomain to a backend target with an always-on Docker Compose service.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="how-it-works">How it Works<a href="#how-it-works" class="hash-link" aria-label="Direct link to How it Works" title="Direct link to How it Works"></a></h2>
<p>The Docker Compose project uses your zrok account token to reserve a public subdomain and keep sharing the backend
@ -169,20 +187,31 @@ target.</p>
</ol>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="create-the-docker-project">Create the Docker Project<a href="#create-the-docker-project" class="hash-link" aria-label="Direct link to Create the Docker Project" title="Direct link to Create the Docker Project"></a></h2>
<ol>
<li>Make a folder on your computer to use as a Docker Compose project for your zrok public share with a reserved subdomain and switch to the new directory in your terminal.</li>
<li>Download <a href="/zrok-public-reserved/compose.yml" target="_blank" rel="noopener noreferrer">the reserved public share <code>compose.yml</code> project file</a> into the same directory.</li>
<li>Copy your zrok account&#x27;s enable token from the zrok web console to your clipboard and paste it in a file named <code>.env</code> in the same folder like this:</li>
</ol>
<li>
<p>Make a folder on your computer to use as a Docker Compose project for your zrok public share with a reserved subdomain and switch to the new directory in your terminal.</p>
</li>
<li>
<p>Download <a href="/zrok-public-reserved/compose.yml" target="_blank" rel="noopener noreferrer">the reserved public share <code>compose.yml</code> project file</a> into the same directory.</p>
</li>
<li>
<p>Copy your zrok account&#x27;s enable token from the zrok web console to your clipboard and paste it in a file named <code>.env</code> in the same folder like this:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">.env</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">ZROK_ENABLE_TOKEN=&quot;8UL9-48rN0ua&quot;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<ol>
<li>Run the Compose project to start sharing the built-in demo web server. Be sure to <code>--detach</code> so the project runs in the background if you want it to auto-restart when your computer reboots.</li>
</ol>
</li>
<li>
<p>Name the Share</p>
<p>This unique name becomes part of the domain name of the share, e.g. <code>https://my-prod-app.in.zrok.io</code>. A random name is generated if you don&#x27;t specify one.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">.env</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">ZROK_UNIQUE_NAME=&quot;my-prod-app&quot;</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
</li>
<li>
<p>Run the Compose project to start sharing the built-in demo web server. Be sure to <code>--detach</code> so the project runs in the background if you want it to auto-restart when your computer reboots.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">docker compose up --detach</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<ol>
<li>Get the public share URL from the output of the <code>zrok-share</code> service or by peeking in the zrok console where the share will appear in the graph.</li>
</ol>
</li>
<li>
<p>Get the public share URL from the output of the <code>zrok-share</code> service or by peeking in the zrok console where the share will appear in the graph.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">docker compose logs zrok-share</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="language-buttonless codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">Output</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-buttonless codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">zrok-public-share-1 | https://w6r1vesearkj.in.zrok.io/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
</li>
</ol>
<p>This concludes the minimum steps to begin sharing the demo web server. Read on to learn how to pivot to sharing any website or web service by leveraging additional zrok backend modes.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="proxy-any-web-server">Proxy Any Web Server<a href="#proxy-any-web-server" class="hash-link" aria-label="Direct link to Proxy Any Web Server" title="Direct link to Proxy Any Web Server"></a></h2>
<p>The simplest way to share your existing HTTP server is to set <code>ZROK_TARGET</code> (e.g. <code>https://example.com</code>) in the environment of the <code>docker compose up</code> command. When you restart the share will auto-configure for that URL.</p>
@ -200,27 +229,31 @@ features in <a href="https://blog.openziti.io/the-zrok-oauth-public-frontend" ta
<p>Caddy is the most powerful and flexible backend mode in zrok. You must reserve a new public subdomain whenever you switch the backend mode, so using <code>caddy</code> reduces the risk that you&#x27;ll have to share a new frontend URL with your users.</p>
<p>With Caddy, you can balance the workload for websites or web services or share static sites and files or all of the above at the same time. You can update the Caddyfile and restart the Docker Compose project to start sharing the new configuration with the same reserved public subdomain.</p>
<ol>
<li>Create a Caddyfile. This example demonstrates proxying two HTTP servers with a weighted round-robin load balancer.</li>
</ol>
<li>
<p>Create a Caddyfile. This example demonstrates proxying two HTTP servers with a weighted round-robin load balancer.</p>
<div class="language-console codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">Caddyfile</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-console codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">http:// {</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> # zrok requires this bind address template</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> bind {{ .ZrokBindAddress }}</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> reverse_proxy /* {</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> to http://httpbin1:8080 http://httpbin2:8080</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> lb_policy weighted_round_robin 3 2</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> }</span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<ol>
<li>Create a file <code>compose.override.yml</code>. This example adds two <code>httpbin</code> containers for load balancing, and mounts the Caddyfile into the container.</li>
</ol>
</li>
<li>
<p>Create a file <code>compose.override.yml</code>. This example adds two <code>httpbin</code> containers for load balancing, and mounts the Caddyfile into the container.</p>
<div class="language-yaml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">compose.override.yml</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-yaml codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token key atrule">services</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">httpbin1</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">image</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> mccutchen/go</span><span class="token punctuation" style="color:rgb(248, 248, 242)">-</span><span class="token plain">httpbin </span><span class="token comment" style="color:rgb(98, 114, 164)"># 8080/tcp</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">httpbin2</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">image</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"> mccutchen/go</span><span class="token punctuation" style="color:rgb(248, 248, 242)">-</span><span class="token plain">httpbin </span><span class="token comment" style="color:rgb(98, 114, 164)"># 8080/tcp</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">zrok-share</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token key atrule">volumes</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain"></span><br></span><span class="token-line" style="color:#F8F8F2"><span class="token plain"> </span><span class="token punctuation" style="color:rgb(248, 248, 242)">-</span><span class="token plain"> ./Caddyfile</span><span class="token punctuation" style="color:rgb(248, 248, 242)">:</span><span class="token plain">/mnt/.zrok/Caddyfile</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<ol>
<li>Start a new Docker Compose project or delete the existing state volume.</li>
</ol>
</li>
<li>
<p>Start a new Docker Compose project or delete the existing state volume.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">docker compose down --volumes</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
</li>
</ol>
<p>If you prefer to keep using the same zrok environment with the new share then delete <code>/mnt/.zrok/reserved.json</code> instead of the entire volume.</p>
<ol>
<li>Run the project to load the new configuration.</li>
</ol>
<li>
<p>Run the project to load the new configuration.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">docker compose up --detach</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<ol>
<li>Note the new reserved share URL from the log.</li>
</ol>
</li>
<li>
<p>Note the new reserved share URL from the log.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">docker compose logs zrok-share</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="language-buttonless codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">Output</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-buttonless codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">INFO: zrok public URL: https://88s803f2qvao.in.zrok.io/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div></div></div></div>
<div class="language-buttonless codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#F8F8F2;--prism-background-color:#282A36"><div class="codeBlockTitle_Ktv7">Output</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-buttonless codeBlock_bY9V thin-scrollbar" style="color:#F8F8F2;background-color:#282A36"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#F8F8F2"><span class="token plain">INFO: zrok public URL: https://88s803f2qvao.in.zrok.io/</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="Copy code to clipboard" title="Copy" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
</li>
</ol></div></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="concepts">Concepts<a href="#concepts" class="hash-link" aria-label="Direct link to Concepts" title="Direct link to Concepts"></a></h2>
<p>Overview of <a href="/docs/concepts/sharing-reserved/">zrok reserved shares</a></p></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/openziti/zrok/blob/main/docs/../docs/guides/frontdoor.mdx" target="_blank" rel="noopener noreferrer" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_Z9Sw" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>Edit this page</a></div><div class="col lastUpdated_vwxv"></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--prev" href="/docs/guides/install/windows/"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Windows</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/docs/category/docker-share/"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Docker Share</div></a></nav></div></div></div></div></main></div></div></div><footer class="footer footer--dark"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="footer__copyright">Copyright © 2023 NetFoundry Inc. Built with Docusaurus.</div></div></div></footer></div>
</body>

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -10,7 +10,7 @@
<link rel="search" type="application/opensearchdescription+xml" title="Zrok" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e053e05e.css">
<script src="/assets/js/runtime~main.def6bf3e.js" defer="defer"></script>
<script src="/assets/js/runtime~main.06ca167c.js" defer="defer"></script>
<script src="/assets/js/main.e81e0009.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">

View File

@ -38,6 +38,7 @@ services:
STATE_DIRECTORY: /mnt # zrok homedir in container
# most relevant options
ZROK_UNIQUE_NAME: # name is used to construct frontend domain name, e.g. "myapp" in "myapp.share.zrok.io"
ZROK_BACKEND_MODE: # web, caddy, drive, proxy
ZROK_TARGET: # backend target, is a path in container filesystem unless proxy mode
ZROK_INSECURE: # "--insecure" if proxy target has unverifiable TLS server certificate