• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

m-lab / locate / 21512163100

30 Jan 2026 10:10AM UTC coverage: 82.209% (+0.06%) from 82.148%
21512163100

push

github

web-flow
fix(handler): handle preflight CORS request (#248)

When we make a request with `Authorization` for m-lab/locate from
https://github.com/m-lab/mlab-speedtest/pull/81, the request itself stops
being a [simple request](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS#simple_requests)
and becomes a [preflighted request](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS#preflighted_requests).

This happens because the `Authorization` header is not in the set
of headers allowed for simple requests. As such, a browser will issue
a `OPTIONS *` request first to check whether the server would accept
such a request or not.

In turn, this causes a `403` when trying to invoke m-lab/locate in
https://github.com/m-lab/mlab-speedtest/pull/81.

To address this issue, we extend the set of allowed methods to also
include `OPTIONS` and we handle `OPTIONS *` by returning `200`. We
return `200` because of https://stackoverflow.com/a/46028619.

2389 of 2906 relevant lines covered (82.21%)

6.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.51
/handler/handler.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc