Skip to content

Commit

Permalink
Support HOMEPAGE_PROXY_DISABLE_IPV6
Browse files Browse the repository at this point in the history
  • Loading branch information
shamoon committed Feb 28, 2025
1 parent 58391ff commit cd48ffc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
10 changes: 10 additions & 0 deletions docs/installation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ You have a few options for deploying homepage, depending on your needs. We offer

</div>

## Environment Variables

### `HOMEPAGE_ALLOWED_HOSTS`

Required.

As of v1.0 there is one required environment variable when deploying via a public URL, <code>HOMEPAGE_ALLOWED_HOSTS</code>. This is a comma separated list of allowed hosts that can access your homepage. See the [docker](docker.md) and [source](source.md) installation pages for examples.

### `HOMEPAGE_PROXY_DISABLE_IPV6`

Optional.

In certain environments, you may need to disable IPv6 for the proxy to work correctly. Set this environment variable to `true` to disable IPv6.
11 changes: 4 additions & 7 deletions src/utils/proxy/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,18 @@ export function httpRequest(url, params) {

export async function httpProxy(url, params = {}) {
const constructedUrl = new URL(url);
const disableIpv6 = process.env.HOMEPAGE_PROXY_DISABLE_IPV6 === "true";
const agentOptions = disableIpv6 ? { family: 4, autoSelectFamily: false } : {};

let request = null;
if (constructedUrl.protocol === "https:") {
request = httpsRequest(constructedUrl, {
agent: new https.Agent({
rejectUnauthorized: false,
autoSelectFamily: true,
}),
agent: new https.Agent({ ...agentOptions, rejectUnauthorized: false }),
...params,
});
} else {
request = httpRequest(constructedUrl, {
agent: new http.Agent({
autoSelectFamily: true,
}),
agent: new http.Agent(agentOptions),
...params,
});
}
Expand Down

0 comments on commit cd48ffc

Please sign in to comment.