Skip to content

Commit

Permalink
Merge pull request #2943 from OpenNeuroOrg/server/api-prefix
Browse files Browse the repository at this point in the history
fix(server): Allow /api in addition to /crn for API requests
  • Loading branch information
nellh authored Nov 19, 2023
2 parents 114c524 + 05d83bf commit e889a4d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions nginx/nginx.dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion packages/openneuro-server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -98,7 +99,7 @@ export async function expressApolloSetup() {

// Setup GraphQL middleware
app.use(
["/graphql", "/crn/graphql"],
["/graphql", "/crn/graphql", "/api/graphql"],
cors<cors.CorsRequest>(),
jwt.authenticate,
auth.optional,
Expand Down

0 comments on commit e889a4d

Please sign in to comment.