diff --git a/src/components/services/widgets/service/pihole.jsx b/src/components/services/widgets/service/pihole.jsx index c477ca332..c29b5d6c1 100644 --- a/src/components/services/widgets/service/pihole.jsx +++ b/src/components/services/widgets/service/pihole.jsx @@ -7,7 +7,13 @@ export default function Pihole({ service }) { const config = service.widget; function buildApiUrl(endpoint) { - const { url } = config; + const { url, proxy } = config; + + if (proxy) { + const fullUrl = `${url}/admin/${endpoint}`; + return "/api/proxy?url=" + encodeURIComponent(fullUrl); + } + return `${url}/admin/${endpoint}`; }