Improved CORS!!!!
This commit is contained in:
@@ -30,6 +30,28 @@ class Settings(BaseSettings):
|
|||||||
FILES_PATH = {}
|
FILES_PATH = {}
|
||||||
|
|
||||||
|
|
||||||
|
# CORS Origins
|
||||||
|
ORIGINS_REGEX = '(https://.*\.oneskyit\.com)|(http://.*\.oneskyit\.local)|(http://.*\.oneskyit\.local:5000)|(http://.*.localhost)|(http://.*.localhost:5000)'
|
||||||
|
|
||||||
|
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://demo.localhost:5000',
|
||||||
|
|
||||||
|
'http://svelte.oneskyit.local:5555',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# HTTP Status Dict List
|
# HTTP Status Dict List
|
||||||
HTTP_STATUS_LI = {}
|
HTTP_STATUS_LI = {}
|
||||||
HTTP_STATUS_LI[200] = { 'name': 'OK', 'message': 'The request has succeeded.' }
|
HTTP_STATUS_LI[200] = { 'name': 'OK', 'message': 'The request has succeeded.' }
|
||||||
|
|||||||
67
app/main.py
67
app/main.py
@@ -409,70 +409,13 @@ app.include_router(
|
|||||||
|
|
||||||
|
|
||||||
# BEGIN: CORS
|
# BEGIN: CORS
|
||||||
# NOTE: Need to .localhost for less browser restrictions! Mainly for audio and video.
|
# NOTE: Need to include .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',
|
|
||||||
]
|
|
||||||
|
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins = origins,
|
# allow_origins = origins,
|
||||||
allow_origin_regex = 'https://.*\.oneskyit\.com',
|
allow_origins = config.settings.ORIGINS,
|
||||||
|
allow_origin_regex = config.settings.ORIGINS_REGEX,
|
||||||
|
# allow_origin_regex = 'https://.*\.oneskyit\.com',
|
||||||
allow_credentials = True,
|
allow_credentials = True,
|
||||||
allow_methods = ['*'],
|
allow_methods = ['*'],
|
||||||
allow_headers = ['*'],
|
allow_headers = ['*'],
|
||||||
|
|||||||
Reference in New Issue
Block a user