<p dir="auto">Currently it is impossible to modify the Host header when calling <code class="notranslate">fetch()</code>.</p>
<p dir="auto">This is <em>not</em> a duplicate of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="923856528" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/11017" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/11017/hovercard" href="https://github.com/denoland/deno/issues/11017">#11017</a> , because that asked to disallow the header to be modified, while I am requesting for a way to allow modifying it.</p>
<p dir="auto">It is needed for us to communicate with an internal system that only ever expects the <code class="notranslate">Host</code> header to be an external-facing domain. (a reverse proxy or changing the machines <code class="notranslate">/etc/hosts</code> seems a bit overkill)</p>
<p dir="auto">It could be part of <code class="notranslate">Deno.createHttpClient</code> (<code class="notranslate">{allowCustomHost: true}</code> or similar) as described in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="665242054" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/6868" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/6868/hovercard?comment_id=762013710&amp;comment_type=issue_comment" href="https://github.com/denoland/deno/issues/6868#issuecomment-762013710">#6868 (comment)</a></p>
<p dir="auto">I think this would make deno.land/x way more usable outside Deno too. Currently Deno works well with ES Modules, but deno.land/x does not provide JS files that could be used in vanilla browser script tags or JS files.</p>
<p dir="auto">For instance sometimes I find a nice Deno library, and because most Deno code follows standards, I could import it in the browser. But I can't because <code class="notranslate">deno.land/x/</code> does not provide JS files, it only provides TS files, e.g.</p>
<div class="highlight highlight-text-html-basic notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;script type=&quot;module&quot;&gt;
import { pathToRegexp, match, parse, compile } from &quot;https://deno.land/x/path_to_regexp@v6.2.0/index.js&quot;
&lt;/script&gt;"><pre class="notranslate"><span class="pl-kos">&lt;</span><span class="pl-ent">script</span> <span class="pl-c1">type</span>="<span class="pl-s">module</span>"<span class="pl-kos">&gt;</span>
<span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">pathToRegexp</span><span class="pl-kos">,</span> <span class="pl-s1">match</span><span class="pl-kos">,</span> <span class="pl-s1">parse</span><span class="pl-kos">,</span> <span class="pl-s1">compile</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">"https://deno.land/x/path_to_regexp@v6.2.0/index.js"</span>
<span class="pl-kos">&lt;/</span><span class="pl-ent">script</span><span class="pl-kos">&gt;</span></pre></div>
<p dir="auto">Does not work, because <code class="notranslate">https://deno.land/x/path_to_regexp@v6.2.0/index.ts</code> is just a TS file. Then I have to jump hoops to get it in my adhoc script tags.</p>
<p dir="auto">Third Party Modules library could just compile all TS files to JS files when updated, then they would be usable in the browser as well.</p>