Skip to content

rearrange middleware so CORS is applied to all responses#391

Merged
hholb merged 1 commit into
devfrom
hholb/coors-fix
Mar 10, 2026
Merged

rearrange middleware so CORS is applied to all responses#391
hholb merged 1 commit into
devfrom
hholb/coors-fix

Conversation

@hholb

@hholb hholb commented Mar 10, 2026

Copy link
Copy Markdown
Member

Follow up to #389

Overview

This PR fixes and issue I found testing yesterday's changes in staging:
image

Our nice error messages aren't accessible due to missing CORS headers. I think this is due to the order we are applying the middlewares:

Before (broken):
Request → HeaderLogging → RequestID → ProcessTime → ErrorHandling → CORS → Routes

Errors are bypassing the CORS middleware, so making sure we wrap the response with CORS headers first should fix the issue.

After (fixed, hopefully):
Request → CORS → HeaderLogging → RequestID → ProcessTime → ErrorHandling → Routes

Testing

Tough to test locally since my local setup doesn't send cross-origin requests. We will need to get this into dev to see if it works.

@hholb hholb merged commit 029d479 into dev Mar 10, 2026
1 check passed
@hholb hholb deleted the hholb/coors-fix branch March 10, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants