debug: with hardcoded domain testing.dscrs.site and in default non for understanding
All checks were successful
Deploy on push / deploy (push) Successful in 1m0s
All checks were successful
Deploy on push / deploy (push) Successful in 1m0s
This commit is contained in:
parent
4ebc64d13a
commit
46945197d9
23
main.py
23
main.py
|
@ -124,33 +124,12 @@ app = Starlette(
|
|||
debug=True,
|
||||
)
|
||||
|
||||
# Define allowed origins based on environment
|
||||
allowed_origins_dev = ["https://localhost:3000"] # Dev environment
|
||||
allowed_origins_prod = [
|
||||
"https://testing.dscrs.site", # Preview environment
|
||||
"https://testing.discours.io", # Preview environment
|
||||
]
|
||||
|
||||
# Add ExceptionHandlerMiddleware
|
||||
app.add_middleware(ExceptionHandlerMiddleware)
|
||||
|
||||
# Add CORS middleware for "dev" mode
|
||||
if "dev" in sys.argv:
|
||||
print("Running in development mode with CORS for localhost.")
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=allowed_origins_dev,
|
||||
allow_origins=["https://localhost:3000"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
else:
|
||||
# Add CORS middleware for production/preview mode
|
||||
print(f"Running in {MODE} mode with CORS for production/preview.")
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=allowed_origins_prod,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"], # Allow all HTTP methods
|
||||
allow_headers=["*"], # Allow all headers
|
||||
)
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
log_format custom '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'origin=$http_origin status=$status allow_origin=$allow_origin '
|
||||
'origin=$http_origin allow_origin=$allow_origin status=$status '
|
||||
'"$http_referer" "$http_user_agent"';
|
||||
|
||||
{{ $proxy_settings := "proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_set_header Host $http_host; proxy_set_header X-Request-Start $msec;" }}
|
||||
{{ $gzip_settings := "gzip on; gzip_min_length 1100; gzip_buffers 4 32k; gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/x-javascript application/json application/xml application/rss+xml font/truetype application/x-font-ttf font/opentype application/vnd.ms-fontobject image/svg+xml; gzip_vary on; gzip_comp_level 6;" }}
|
||||
|
||||
map $http_origin $allow_origin {
|
||||
~^https?:\/\/testing\.dscrs\.site$ $http_origin;
|
||||
~^https?:\/\/(.*\.)?localhost(:\d+)?$ $http_origin;
|
||||
~^https?:\/\/(.*\.)?discours\.io$ $http_origin;
|
||||
~^https?:\/\/(.*\.)?dscrs\.site$ $http_origin;
|
||||
~^https?:\/\/discoursio-webapp(-.*)?\.vercel\.app$ $http_origin;
|
||||
default "";
|
||||
default "non";
|
||||
}
|
||||
|
||||
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m max_size=1g
|
||||
|
|
Loading…
Reference in New Issue
Block a user