Skip to content

Commit

Permalink
Bypass cache for origin
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlee85 committed Jan 9, 2024
1 parent 725de66 commit a4db3e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import HmacSHA1 from 'crypto-js/hmac-sha1';
import Base64 from 'crypto-js/enc-base64';
import createFetchForOrigin from '../../../utils/createFetchForOrigin';

const fetch = createFetchForOrigin('echo');
const fetch = createFetchForOrigin('echo', {
edgio: {
caching: {
bypass_cache: true,
},
},
});

export async function handleHttpRequest(request, context) {
// ** IMPORTANT **
Expand Down
4 changes: 4 additions & 0 deletions examples/v7-edge-functions/utils/createFetchForOrigin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ export default function createFetchWithOrigin(originName: string) {
}

return async (url: string | Request, options: any = {}) => {
const edgio = options.edgio || {};
delete options.edgio;

const modifiedOptions = {
...options,
edgio: {
...edgio,
origin: originName,
},
};
Expand Down

0 comments on commit a4db3e4

Please sign in to comment.