Improved CORS!!!!

This commit is contained in:
Scott Idem
2022-11-29 15:12:04 -05:00
parent 3de7d580dc
commit e4ca27a84d
2 changed files with 27 additions and 62 deletions

View File

@@ -409,70 +409,13 @@ app.include_router(
# BEGIN: CORS
# NOTE: Need to .localhost for less browser restrictions! Mainly for audio and video.
origins = [
'https://oneskyit.com',
'http://app-local.oneskyit.com',
'http://192.168.32.20:3000',
'http://192.168.32.20:8080',
'http://localhost',
'http://localhost:3000',
'http://localhost:5000',
'http://localhost:8080',
'http://localhost:7800',
'http://fastapi.localhost',
'http://api.oneskyit.local:5000',
'http://app.oneskyit.local:5000',
'http://fastapi.oneskyit.local:5000',
'http://svelte.oneskyit.local:5555',
'http://connect.localhost:5000', # Using localhost
'http://connect.oneskyit.local:5000',
'http://demo.localhost:5000', # Using localhost
'http://demo.oneskyit.local:5000',
'http://dev.localhost:5000', # Using localhost
'http://dev.oneskyit.local:5000',
'http://dev-app.oneskyit.local:5000',
'http://dev-svelte.oneskyit.local:5555',
'http://dev-cmsc.oneskyit.local:5000',
'http://dev-idaa.oneskyit.local:5000',
'http://dev-ishlt.oneskyit.local:5000',
'http://cmsc.oneskyit.local:5000',
'http://idaa.oneskyit.local:5000',
'http://ishlt.oneskyit.local:5000',
'http://businessgroup.oneskyit.local:5000',
'http://aapor.oneskyit.local:5000',
'http://dev-ishlt.localhost:5000', # Using localhost
'http://lci.localhost:5000', # Using localhost
'http://ishlt.localhost:5000', # Using localhost
'http://npa.localhost:5000', # Using localhost
'http://lci.internal:5000', # Using internal; just in case guess before LCI
'http://lci.oneskyit.internal:5000', # Using internal; just in case guess before LCI
'http://lci.oneskyit.internal', # Using internal; just in case guess before LCI
'http://lci.local:5000', # Using local; just in case guess before LCI
'http://lci.oneskyit.local:5000', # Using local; just in case guess before LCI
'http://lci.oneskyit.local', # Using local; just in case guess before LCI
'https://dev-api.oneskyit.com',
'https://ishlt.oneskyit.com',
'http://cmsc.oneskyit.local',
]
# NOTE: Need to include .localhost for less browser restrictions! Mainly for audio and video.
app.add_middleware(
CORSMiddleware,
allow_origins = origins,
allow_origin_regex = 'https://.*\.oneskyit\.com',
# allow_origins = origins,
allow_origins = config.settings.ORIGINS,
allow_origin_regex = config.settings.ORIGINS_REGEX,
# allow_origin_regex = 'https://.*\.oneskyit\.com',
allow_credentials = True,
allow_methods = ['*'],
allow_headers = ['*'],