Fetch Url Widget Repository behind corporate proxy (#1238) (#1239)

This commit is contained in:
Tristan Robert
2024-10-04 01:15:20 +02:00
committed by GitHub
parent 35a429d99e
commit 1cf52e1b0a
2 changed files with 3 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import {GristServer} from 'app/server/lib/GristServer';
import LRUCache from 'lru-cache';
import * as url from 'url';
import { AsyncCreate } from 'app/common/AsyncCreate';
import { proxyAgent } from 'app/server/lib/ProxyAgent';
// Static url for UrlWidgetRepository
const STATIC_URL = process.env.GRIST_WIDGET_LIST_URL;
@@ -109,7 +110,7 @@ export class UrlWidgetRepository implements IWidgetRepository {
return [];
}
try {
const response = await fetch(this._staticUrl);
const response = await fetch(this._staticUrl, { agent: proxyAgent(new URL(this._staticUrl)) });
if (!response.ok) {
if (response.status === 404) {
throw new ApiError('WidgetRepository: Remote widget list not found', 404);