Skip to content

Commit

Permalink
Fix bad Origin header in the dev proxy
Browse files Browse the repository at this point in the history
We found that our service, at `/api/rhsm-subscriptions/v1` was rejecting
requests made by the dev proxy due to a bad `Origin` header.

I discovered it is because the proxy generates an `Origin` value with a
trailing slash.

This change strips the trailing slash.

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin
  • Loading branch information
kahowell committed Oct 11, 2024
1 parent 6a97561 commit b2b8aae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/config-utils/src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ const proxy = ({
headers: {
// Staging Akamai CORS gives 403s for non-GET requests from non-origin hosts
Host: target.replace('https://', ''),
Origin: target,
// Origin format is protocol://hostname:port only, remove any trailing slash
Origin: target.replace(/\/$/, ''),
},
}),
});
Expand Down

0 comments on commit b2b8aae

Please sign in to comment.