Skip to content

Commit

Permalink
fix for proxy origin
Browse files Browse the repository at this point in the history
  • Loading branch information
ikreymer committed Oct 19, 2024
1 parent 39bb3ed commit 4685498
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ export class Collection {
return response;
}

const opts = { pageId: query.pageId };
const opts = { pageId: query.pageId, noRedirect: query.isProxyOrigin};

response = await this.store.getResource(query, this.prefix, event, opts);

Expand Down
3 changes: 3 additions & 0 deletions src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export class ArchiveRequest {
hash = "";
cookie = "";

isProxyOrigin = false;

request: Request;
method: string;
mode: string;
Expand Down Expand Up @@ -66,6 +68,7 @@ export class ArchiveRequest {
if (url.origin === localOrigin) {
this.url = proxyOrigin + url.pathname + (url.search ? url.search : "");
}
this.isProxyOrigin = true;
}

const hashIndex = this.url.indexOf("#");
Expand Down
5 changes: 4 additions & 1 deletion src/wacz/multiwacz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ export class MultiWACZ
event: FetchEvent,
// [TODO]
// eslint-disable-next-line @typescript-eslint/no-explicit-any
{ pageId }: Record<string, any> = {},
{ pageId, noRedirect }: Record<string, any> = {},
): Promise<ArchiveResponse | Response | null> {
await this.initing;

Expand Down Expand Up @@ -1097,6 +1097,9 @@ export class MultiWACZ
loadFirst: true,
});
if (resp) {
if (noRedirect) {
return resp;
}
foundMap.set((resp as ArchiveResponse).date, { name, hash: file.hash });
}
}
Expand Down

0 comments on commit 4685498

Please sign in to comment.