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

Make CORS option configurable #2812

Closed
nicolargo opened this issue Jun 1, 2024 · 2 comments
Closed

Make CORS option configurable #2812

nicolargo opened this issue Jun 1, 2024 · 2 comments

Comments

@nicolargo
Copy link
Owner

nicolargo commented Jun 1, 2024

Related to #2802

Make the CORS section of the API configurable:

        # FastAPI Enable CORS
        # https://fastapi.tiangolo.com/tutorial/cors/
        self._app.add_middleware(
            CORSMiddleware,
            # Related to https://github.com/nicolargo/glances/discussions/2802
            # allow_origins=[self.bind_url],
            allow_origins=["*"],
            allow_credentials=True,
            allow_methods=["*"],
            allow_headers=["*"],
        )

the origins, credentials , methods and headers should be configurable from the Glances configuration file:

[outputs]
cors_origins=*
cors_credentials=True
cors_methods=*
cors_headers=*

Default values should be the ones in th previous example.

@nicolargo
Copy link
Owner Author

Merged into develop.

@LeeThompson
Copy link

Working great! Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants