Skip to content

Commit 99c1ec8

Browse files
committed
refactor: remove proxy, CORS is fixed
1 parent 47c833e commit 99c1ec8

4 files changed

Lines changed: 2 additions & 23 deletions

File tree

deploy/nginx.conf

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,6 @@ server {
3434
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
3535
}
3636

37-
# ------------------------------------------------------------------
38-
# S3 data-asset-cache proxy
39-
# Avoids CORS — browser fetches squirrel.json from same origin;
40-
# nginx forwards to S3. Mirrors the Vite dev proxy.
41-
# ------------------------------------------------------------------
42-
location /data-asset-cache/ {
43-
proxy_pass https://allen-data-views.s3.us-west-2.amazonaws.com/data-asset-cache/;
44-
proxy_set_header Host allen-data-views.s3.us-west-2.amazonaws.com;
45-
proxy_ssl_server_name on;
46-
}
47-
4837
# ------------------------------------------------------------------
4938
# duckdb-server WebSocket proxy
5039
# Strips the /ws prefix — duckdb-server listens at its root path.

web/src/__tests__/constants.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ describe('constants', () => {
3030
});
3131

3232
it('SQUIRREL_URL points to the squirrel.json metadata file', () => {
33+
expect(SQUIRREL_URL).toContain('allen-data-views');
3334
expect(SQUIRREL_URL).toContain('data-asset-cache');
3435
expect(SQUIRREL_URL).toContain('squirrel.json');
3536
});

web/src/constants.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@ export const S3_BUCKET = 'allen-data-views';
2020
/**
2121
* URL of the squirrel JSON metadata file.
2222
* Fetched once at startup to discover all available datasets ("acorns").
23-
*
24-
* Always uses a same-origin relative path so the browser never makes a
25-
* cross-origin request to S3:
26-
* - Development: Vite proxies /data-asset-cache → S3.
27-
* - Production: nginx proxies /data-asset-cache → S3 (see deploy/nginx.conf).
2823
*/
29-
export const SQUIRREL_URL = '/data-asset-cache/squirrel.json';
24+
export const SQUIRREL_URL = `https://${S3_BUCKET}.s3.${S3_REGION}.amazonaws.com/data-asset-cache/squirrel.json`;
3025

3126
// ---------------------------------------------------------------------------
3227
// AIND brand colours (ported from src/zombie/layout.py)

web/vite.config.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ export default defineConfig({
1313
target: 'http://localhost:3001',
1414
rewrite: (path) => path.replace(/^\/docdb/, ''),
1515
},
16-
// Forward /data-asset-cache/* to the public S3 bucket (avoids CORS
17-
// in development; production uses the direct S3 URL).
18-
'/data-asset-cache': {
19-
target: 'https://allen-data-views.s3.us-west-2.amazonaws.com',
20-
changeOrigin: true,
21-
},
2216
},
2317
},
2418

0 commit comments

Comments
 (0)