Skip to content

Commit

Permalink
fix: reverse proxy url fix
Browse files Browse the repository at this point in the history
  • Loading branch information
klopfdreh committed Apr 3, 2024
1 parent 21825fa commit 7feba18
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ui/src/app/shared/api/task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export class TaskService {
`tasks/logs/${taskExecution.externalExecutionId}?platformName=${platformName}&schemaTarget=${taskExecution.schemaTarget}`;
const params = new HttpParams({encoder: new DataflowEncoder()});
return this.httpClient
.get<any>(url, {
.get<any>(UrlUtilities.fixReverseProxyUrl(url), {
headers,
params
})
Expand Down
13 changes: 13 additions & 0 deletions ui/src/app/url-utilities.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,17 @@ export class UrlUtilities {
path += path.endsWith('/') ? '' : '/';
return path;
}

public static fixReverseProxyUrl(url: string) {
try {
const urlToFix: URL = new URL(url);
const baseUrl: URL = new URL(window.location.href);
urlToFix.host = baseUrl.host;
urlToFix.protocol = baseUrl.protocol;
urlToFix.port = baseUrl.port;
return urlToFix.href;
} catch (_) {
return url;
}
}
}

0 comments on commit 7feba18

Please sign in to comment.