Skip to content

Commit

Permalink
add no cache header option
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrrt committed Jan 2, 2024
1 parent 01a770b commit 784c3b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/dry-gifts-smash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@authdog/hydra-core": patch
---

add no-cache header option
6 changes: 5 additions & 1 deletion packages/core/src/handlers/hydra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export const HydraHandler = async (req, env, ctx): Promise<Response> => {
req.headers.get("x-cluster-client-ip") ||
req.headers.get("x-forwarded");

const skipCache = req.headers.get("x-hydra-skip-cache") === "true";

const facetId = ip || "localhost"; // TODO: extend to more facets combinations
const defaultRateLimitingBudget = hydraConfig.rateLimiting.default.budget;
let remainingRateBudget = -1;
Expand All @@ -50,7 +52,9 @@ export const HydraHandler = async (req, env, ctx): Promise<Response> => {

let extractedQueries = [];

if (isIntrospection) {
const directQuery = isIntrospection || skipCache;

if (directQuery) {
return await GraphQLHandler(req, env, ctx);
}

Expand Down

0 comments on commit 784c3b5

Please sign in to comment.