mirror of
https://github.com/gethomepage/homepage.git
synced 2026-04-14 14:11:21 -07:00
Enhancement: fully support custom headers (#6125)
This commit is contained in:
@@ -27,6 +27,9 @@ export default async function credentialedProxyHandler(req, res, map) {
|
||||
|
||||
const headers = {
|
||||
"Content-Type": "application/json",
|
||||
...(widgets[widget.type].headers ?? {}),
|
||||
...(widget.headers ?? {}),
|
||||
...(req.extraHeaders ?? {}),
|
||||
};
|
||||
|
||||
if (widget.type === "stocks") {
|
||||
|
||||
@@ -25,7 +25,11 @@ export default async function genericProxyHandler(req, res, map) {
|
||||
}
|
||||
const url = new URL(urlString);
|
||||
|
||||
const headers = req.extraHeaders ?? widget.headers ?? widgets[widget.type].headers ?? {};
|
||||
const headers = {
|
||||
...(widgets[widget.type].headers ?? {}),
|
||||
...(widget.headers ?? {}),
|
||||
...(req.extraHeaders ?? {}),
|
||||
};
|
||||
|
||||
if (widget.username && widget.password) {
|
||||
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
|
||||
|
||||
Reference in New Issue
Block a user