Merge pull request #478 from talvasconcelos/fix/CORS_origins

allow all origins to request from lnbits
This commit is contained in:
Arc 2021-12-30 17:09:24 +00:00 committed by GitHub
commit 480546ded7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,5 @@
import asyncio import asyncio
import importlib import importlib
from lnbits.core.tasks import register_task_listeners
import sys import sys
import traceback import traceback
import warnings import warnings
@ -12,6 +11,7 @@ from fastapi.middleware.gzip import GZipMiddleware
from fastapi.staticfiles import StaticFiles from fastapi.staticfiles import StaticFiles
import lnbits.settings import lnbits.settings
from lnbits.core.tasks import register_task_listeners
from .commands import db_migrate, handle_assets from .commands import db_migrate, handle_assets
from .core import core_app from .core import core_app
@ -45,12 +45,11 @@ def create_app(config_object="lnbits.settings") -> FastAPI:
"/core/static", StaticFiles(directory="lnbits/core/static"), name="core_static" "/core/static", StaticFiles(directory="lnbits/core/static"), name="core_static"
) )
origins = ["http://localhost", "http://localhost:5000"] origins = ["*"]
app.add_middleware( app.add_middleware(
CORSMiddleware, CORSMiddleware,
allow_origins=origins, allow_origins=origins,
allow_credentials=True,
allow_methods=["*"], allow_methods=["*"],
allow_headers=["*"], allow_headers=["*"],
) )