tetrio / issues

Report issues and discuss improvements / feature requests around TETR.IO
https://tetr.io
387 stars 21 forks source link

CORs access issue in Tetr.io API #1243

Closed SpartanApple closed 6 months ago

SpartanApple commented 6 months ago

Checklist

OS and Version

Ubuntu 20.04

Browser and version

Firefox 107.0

Describe the bug/issue

I believe currently the API only supports CORS from tetr.io domain, which makes it difficult to utilize the API in browser applications.

access-control-allow-headers    Authorization, Content-Type
access-control-allow-methods    GET, POST, OPTIONS
access-control-allow-origin https://tetr.io

Error: CORS missing allow origin

Reproducing

No response

Expected behavior

Able to make API request through browser rest calls

Screenshots

No response

Console logs

No response

Additional context

No response

ZaptorZap commented 6 months ago

I believe this is intended. You'll need to use a CORS proxy or something similar to achieve what it is you plan on doing. https://tetr.fires.bz/overlay/ and https://cankyre.github.io/tetostats/ are proven examples of this, the latter of which being open source, albeit offline right now.

o5k commented 6 months ago

This is intentional — direct browser use is hard to work with from our side, as it's easy for such use to scale into far too many requests. Please set up a simple proxy for it!