mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-05 21:47:48 +01:00
Compare commits
6 Commits
7d1e0c087a
...
feature/ht
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bcbb94523 | ||
|
|
b118fa1204 | ||
|
|
b430a6f515 | ||
|
|
8ba3cae921 | ||
|
|
8f25bf5427 | ||
|
|
da823ad7e8 |
@@ -81,3 +81,15 @@ services:
|
||||
sysctls:
|
||||
- net.ipv6.conf.all.disable_ipv6=1
|
||||
```
|
||||
|
||||
## Running homepage behind a proxy
|
||||
|
||||
If you are running homepage behind e.g. squid proxy, you can set the environment variable `HOMEPAGE_HTTP_PROXY` to the URL of your proxy. This will allow homepage to use the proxy for all outgoing requests.
|
||||
|
||||
```yaml
|
||||
services:
|
||||
homepage:
|
||||
...
|
||||
environment:
|
||||
- HOMEPAGE_HTTP_PROXY=http://proxy.local:3128
|
||||
```
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
"dockerode": "^4.0.4",
|
||||
"follow-redirects": "^1.15.9",
|
||||
"gamedig": "^5.2.0",
|
||||
"http-proxy-agent": "^7.0.2",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"i18next": "^24.2.3",
|
||||
"ical.js": "^2.1.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
|
||||
42
pnpm-lock.yaml
generated
42
pnpm-lock.yaml
generated
@@ -29,6 +29,12 @@ importers:
|
||||
gamedig:
|
||||
specifier: ^5.2.0
|
||||
version: 5.2.0
|
||||
http-proxy-agent:
|
||||
specifier: ^7.0.2
|
||||
version: 7.0.2
|
||||
https-proxy-agent:
|
||||
specifier: ^7.0.6
|
||||
version: 7.0.6
|
||||
i18next:
|
||||
specifier: ^24.2.3
|
||||
version: 24.2.3(typescript@5.7.3)
|
||||
@@ -98,10 +104,6 @@ importers:
|
||||
xml-js:
|
||||
specifier: ^1.6.11
|
||||
version: 1.6.11
|
||||
optionalDependencies:
|
||||
osx-temperature-sensor:
|
||||
specifier: ^1.0.8
|
||||
version: 1.0.8
|
||||
devDependencies:
|
||||
'@tailwindcss/forms':
|
||||
specifier: ^0.5.10
|
||||
@@ -151,6 +153,10 @@ importers:
|
||||
typescript:
|
||||
specifier: ^5.7.3
|
||||
version: 5.7.3
|
||||
optionalDependencies:
|
||||
osx-temperature-sensor:
|
||||
specifier: ^1.0.8
|
||||
version: 1.0.8
|
||||
|
||||
packages:
|
||||
|
||||
@@ -824,6 +830,10 @@ packages:
|
||||
engines: {node: '>=0.4.0'}
|
||||
hasBin: true
|
||||
|
||||
agent-base@7.1.3:
|
||||
resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==}
|
||||
engines: {node: '>= 14'}
|
||||
|
||||
ajv@6.12.6:
|
||||
resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
|
||||
|
||||
@@ -1646,10 +1656,18 @@ packages:
|
||||
resolution: {integrity: sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==}
|
||||
engines: {node: '>= 0.8'}
|
||||
|
||||
http-proxy-agent@7.0.2:
|
||||
resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==}
|
||||
engines: {node: '>= 14'}
|
||||
|
||||
http2-wrapper@2.2.1:
|
||||
resolution: {integrity: sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ==}
|
||||
engines: {node: '>=10.19.0'}
|
||||
|
||||
https-proxy-agent@7.0.6:
|
||||
resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==}
|
||||
engines: {node: '>= 14'}
|
||||
|
||||
i18next-fs-backend@1.2.0:
|
||||
resolution: {integrity: sha512-pUx3AcgXCbur0jpFA7U67Z2RJflAcIi698Y8VL+phdOqUchahxriV3Cs+M6UkPNQSS/zPEzWLfdJ8EgjB7HVxg==}
|
||||
|
||||
@@ -3501,6 +3519,8 @@ snapshots:
|
||||
|
||||
acorn@8.14.1: {}
|
||||
|
||||
agent-base@7.1.3: {}
|
||||
|
||||
ajv@6.12.6:
|
||||
dependencies:
|
||||
fast-deep-equal: 3.1.3
|
||||
@@ -4526,11 +4546,25 @@ snapshots:
|
||||
statuses: 2.0.1
|
||||
toidentifier: 1.0.1
|
||||
|
||||
http-proxy-agent@7.0.2:
|
||||
dependencies:
|
||||
agent-base: 7.1.3
|
||||
debug: 4.4.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
http2-wrapper@2.2.1:
|
||||
dependencies:
|
||||
quick-lru: 5.1.1
|
||||
resolve-alpn: 1.2.1
|
||||
|
||||
https-proxy-agent@7.0.6:
|
||||
dependencies:
|
||||
agent-base: 7.1.3
|
||||
debug: 4.4.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
i18next-fs-backend@1.2.0: {}
|
||||
|
||||
i18next@21.10.0:
|
||||
|
||||
@@ -110,21 +110,24 @@ export async function cachedRequest(url, duration = 5, ua = "homepage") {
|
||||
|
||||
export async function httpProxy(url, params = {}) {
|
||||
const constructedUrl = new URL(url);
|
||||
const proxyUrl = process.env.HOMEPAGE_HTTP_PROXY; // e.g. http://proxy.local:3128
|
||||
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({ ...agentOptions, rejectUnauthorized: false }),
|
||||
...params,
|
||||
});
|
||||
let agent;
|
||||
if (proxyUrl) {
|
||||
agent = constructedUrl.protocol === "https:" ? new HttpsProxyAgent(proxyUrl) : new HttpProxyAgent(proxyUrl);
|
||||
logger.debug("Using proxy for request to %s: %s", constructedUrl.href, proxyUrl);
|
||||
} else {
|
||||
request = httpRequest(constructedUrl, {
|
||||
agent: new http.Agent(agentOptions),
|
||||
...params,
|
||||
});
|
||||
agent =
|
||||
constructedUrl.protocol === "https:"
|
||||
? new https.Agent({ ...agentOptions, rejectUnauthorized: false })
|
||||
: new http.Agent(agentOptions);
|
||||
}
|
||||
const request =
|
||||
constructedUrl.protocol === "https:"
|
||||
? httpsRequest(constructedUrl, { agent, ...params })
|
||||
: httpRequest(constructedUrl, { agent, ...params });
|
||||
|
||||
try {
|
||||
const [status, contentType, data, responseHeaders] = await request;
|
||||
|
||||
Reference in New Issue
Block a user