Title: git: WAC preHandler 401/403 responses lack the git CORS headers — browser clients see a CORS error instead of the status · Issue #548 · JavaScriptSolidServer/JavaScriptSolidServer · GitHub
Open Graph Title: git: WAC preHandler 401/403 responses lack the git CORS headers — browser clients see a CORS error instead of the status · Issue #548 · JavaScriptSolidServer/JavaScriptSolidServer
X Title: git: WAC preHandler 401/403 responses lack the git CORS headers — browser clients see a CORS error instead of the status · Issue #548 · JavaScriptSolidServer/JavaScriptSolidServer
Description: Found while writing the #375 test coverage. Gap handleGit sets the canonical git CORS headers (GIT_CORS_HEADERS in src/handlers/git.js:173) on its own success and 4xx paths — that was the #371 fix. But the 401/403 for an unauthorized git...
Open Graph Description: Found while writing the #375 test coverage. Gap handleGit sets the canonical git CORS headers (GIT_CORS_HEADERS in src/handlers/git.js:173) on its own success and 4xx paths — that was the #371 fix....
X Description: Found while writing the #375 test coverage. Gap handleGit sets the canonical git CORS headers (GIT_CORS_HEADERS in src/handlers/git.js:173) on its own success and 4xx paths — that was the #371 fix....
Opengraph URL: https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/548
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"git: WAC preHandler 401/403 responses lack the git CORS headers — browser clients see a CORS error instead of the status","articleBody":"Found while writing the #375 test coverage.\n\n## Gap\n\n`handleGit` sets the canonical git CORS headers (`GIT_CORS_HEADERS` in `src/handlers/git.js:173`) on its own success and 4xx paths — that was the #371 fix. But the **401/403 for an unauthorized git operation is emitted earlier**, by the WAC preHandler in `src/server.js` (~line 540):\n\n```js\nif (!authorized) {\n const message = needsWrite ? 'Write access required for push' : 'Read access required for clone';\n reply.header('WAC-Allow', wacAllow);\n if (!webId) {\n reply.header('WWW-Authenticate', 'Basic realm=\"Solid\"');\n }\n return reply.code(webId ? 403 : 401).send({ error: message });\n}\n```\n\nNo `Access-Control-Allow-*` headers — so a browser-based git client (e.g. jss.live/git/) hitting an auth-gated repo sees a generic CORS/network error instead of the 401, which is exactly the failure mode #371 fixed for the other paths.\n\n## Fix shape\n\nExport `setGitCorsHeaders` (or the `GIT_CORS_HEADERS` constant) from `src/handlers/git.js` and apply it in the preHandler's unauthorized branch (and the 402 branch above it, same reasoning). ~3 lines.\n\n## Test\n\n`test/git-handler.test.js` (added in #375's PR) has a deliberately-scoped test asserting the 401 + `WWW-Authenticate` **without** the CORS assertion, with a comment pointing here. When this lands, extend that test with `assertGitCors(res, ...)`.\n\n## Refs\n\n- #371 — the original git CORS fix this completes\n- #375 — the coverage work that surfaced the gap","author":{"url":"https://github.com/melvincarvalho","@type":"Person","name":"melvincarvalho"},"datePublished":"2026-06-10T15:23:12Z","url":"https://github.com/JavaScriptSolidServer/JavaScriptSolidServer/issues/548"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d29d23bd-2fba-999b-845a-ed182943183c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D2F2:3E5EE1:7C94D2:A48642:6B03964D |
| html-safe-nonce | c903585883888b618a64aca8637ff7f508ec3359985560ed68da95e359167c0a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMkYyOjNFNUVFMTo3Qzk0RDI6QTQ4NjQyOjZCMDM5NjREIiwidmlzaXRvcl9pZCI6IjU3NTAwNzkzMDQwMjk2NzMwMzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b3e4b9f67c2113cd2eb3b6ba94e9ec65ddcf5dec08a8a2a4bf8b63bc0e8a5d0d |
| hovercard-subject-tag | issue:4632602826 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JavaScriptSolidServer/JavaScriptSolidServer/548/issue_layout |
| twitter:image | https://opengraph.githubassets.com/308100acc096a35a2b0d327ab2aac08f18f270a1e3cf3d6f4645399ec78f4ea6/JavaScriptSolidServer/JavaScriptSolidServer/issues/548 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/308100acc096a35a2b0d327ab2aac08f18f270a1e3cf3d6f4645399ec78f4ea6/JavaScriptSolidServer/JavaScriptSolidServer/issues/548 |
| og:image:alt | Found while writing the #375 test coverage. Gap handleGit sets the canonical git CORS headers (GIT_CORS_HEADERS in src/handlers/git.js:173) on its own success and 4xx paths — that was the #371 fix.... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | melvincarvalho |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/JavaScriptSolidServer/JavaScriptSolidServer git https://github.com/JavaScriptSolidServer/JavaScriptSolidServer.git |
| octolytics-dimension-user_id | 205442424 |
| octolytics-dimension-user_login | JavaScriptSolidServer |
| octolytics-dimension-repository_id | 958025407 |
| octolytics-dimension-repository_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 958025407 |
| octolytics-dimension-repository_network_root_nwo | JavaScriptSolidServer/JavaScriptSolidServer |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width