Suwayomi / Suwayomi-Server

A rewrite of Tachiyomi for the Desktop
Mozilla Public License 2.0
3.73k stars 196 forks source link

[Feature Request] Allow CORS #929

Closed taos15 closed 3 months ago

taos15 commented 3 months ago

What feature should be added to Suwayomi?

As an User I want to be able to pass a list of domain to add to the server CORS, so I can make request from other clients using reverse proxy.

The list can be a field array in the config file, or and Enviropment variable. Both if posible.

Javalin CORS implementation

Why/Project's Benefit/Existing Problem

By allowing the user to pass thier allowed domains, the user can host the webui in different domains without having problems to connect to the server.

Robonau commented 3 months ago

the CORS settings are already 100% open https://github.com/Suwayomi/Suwayomi-Server/blob/db5c5ed5344416b1701db1d046861fe3776c5317/server/src/main/kotlin/suwayomi/tachidesk/server/JavalinSetup.kt#L56

https://github.com/Suwayomi/Suwayomi-Server/issues/337

its only an issue i ran in to on nginx no issues on traefik

Syer10 commented 3 months ago

Any CORS settings is just going to get overwritten by your reverse proxy anyway

Robonau commented 3 months ago

Any CORS settings is just going to get overwritten by your reverse proxy anyway

nah, not setting any in nginx should use the source, it just doesn't with suwayomi fsr

taos15 commented 3 months ago

The problem seen to be in the client and reverse proxy implementation, reference WebUI Pr 721. By default one cannot s nd credentials (cookies, jwt), when using wildcard domain. If using reverse proxy, one need to make sure the proxy and the policy control for the subdomain, and the client needs to send the fetch request with the credentials: include field. Closing issues.