Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS and API key #4576

Open
Cyberax opened this issue Jan 10, 2025 · 1 comment
Open

CORS and API key #4576

Cyberax opened this issue Jan 10, 2025 · 1 comment
Labels
bug Something isn't working unconfirmed

Comments

@Cyberax
Copy link

Cyberax commented Jan 10, 2025

CORS needs to be allow-listed for unauthenticated requests (without the API key) otherwise browsers can't use it.

This can be simply done by moving the https://github.com/mudler/LocalAI/blob/07655c0c2e0e5fe2bca86339a12237b69d258636/core/http/app.go#L138C5-L138C16 block before the authorization middleware, or by adding an exception for the OPTIONS HTTP method in

func getApiKeyRequiredFilterFunction(applicationConfig *config.ApplicationConfig) func(*fiber.Ctx) bool {

@Cyberax Cyberax added bug Something isn't working unconfirmed labels Jan 10, 2025
@katerasrael
Copy link

katerasrael commented Feb 5, 2025

This seems to be related to a problem I have, when I try to connect the Thunderbird-Addon ThunderAI to LocalAI.

The Addon tries to get the models from the LocalAI-instance and in the container-logs I can see the following line:
WRN Client error ip=192.168.0.xxx latency=1.571684ms method=OPTIONS status=404 url=/models

See also the issue I opened there micz/ThunderAI#242

[edit: fixed the link]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unconfirmed
Projects
None yet
Development

No branches or pull requests

2 participants