Skip to content

Commit

Permalink
disable new CORS rules for OS Proxy endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Jan 17, 2024
1 parent 9abbe36 commit e6046f5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion api.planx.uk/modules/ordnanceSurvey/routes.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import cors from "cors";
import { Router } from "express";
import { useOrdnanceSurveyProxy } from "./controller";

const router = Router();

router.use("/proxy/ordnance-survey", useOrdnanceSurveyProxy);
// Because this route already uses MAP_ALLOWLIST, disable global CORS checks so map repo docs and HTML templates are accessible
const osProxyCORSOptions = {
credentials: true,
methods: "*",
};

router.options("/proxy/ordnance-survey", cors(osProxyCORSOptions));
router.use("/proxy/ordnance-survey", cors(osProxyCORSOptions), useOrdnanceSurveyProxy);

export default router;

0 comments on commit e6046f5

Please sign in to comment.