-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
disable new CORS rules for OS Proxy endpoint
- Loading branch information
1 parent
9abbe36
commit e6046f5
Showing
1 changed file
with
9 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |