From 05d83bfc1133972ce4b5fb5448e6dd045bfb53ac Mon Sep 17 00:00:00 2001 From: Nell Hardcastle Date: Wed, 15 Nov 2023 16:28:18 -0800 Subject: [PATCH] refactor(server): Allow /api in addition to /crn for API requests --- nginx/nginx.dev.conf | 10 ++++++++++ packages/openneuro-server/src/app.ts | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/nginx/nginx.dev.conf b/nginx/nginx.dev.conf index c88233f7f..c14087c91 100644 --- a/nginx/nginx.dev.conf +++ b/nginx/nginx.dev.conf @@ -36,6 +36,16 @@ server { proxy_pass http://server:8111; } + location /api { + client_max_body_size 0; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Connection ""; + proxy_http_version 1.1; + proxy_request_buffering off; + proxy_pass http://server:8111; + } + # Sitemap path location /sitemap.xml { client_max_body_size 0; diff --git a/packages/openneuro-server/src/app.ts b/packages/openneuro-server/src/app.ts index c1db69449..042beb0be 100644 --- a/packages/openneuro-server/src/app.ts +++ b/packages/openneuro-server/src/app.ts @@ -58,6 +58,7 @@ export async function expressApolloSetup() { // routing --------------------------------------------------------- app.use("/sitemap.xml", sitemapHandler) app.use(config.apiPrefix, routes) + app.use("/api/", routes) const httpServer = createServer(app) @@ -98,7 +99,7 @@ export async function expressApolloSetup() { // Setup GraphQL middleware app.use( - ["/graphql", "/crn/graphql"], + ["/graphql", "/crn/graphql", "/api/graphql"], cors(), jwt.authenticate, auth.optional,