diff --git a/INSTALL.md b/INSTALL.md index a2cca123a..cf9c2e779 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -112,9 +112,17 @@ server { listen [::]:80; server_name datasets-preview.huggingface.tech; + add_header 'Access-Control-Allow-Origin' '*'; + access_log /var/log/nginx/reverse-access.log; error_log /var/log/nginx/reverse-error.log; + # due to https://github.com/encode/starlette/issues/950, which generates errors in Safari: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/CreatingVideoforSafarioniPhone/CreatingVideoforSafarioniPhone.html#//apple_ref/doc/uid/TP40006514-SW6 + # we serve the static files from nginx instead of starlette + location /assets { + root /home/hf/.cache/datasets_preview_backend_assets + } + location / { proxy_pass http://localhost:8000/; proxy_set_header Host $proxy_host; diff --git a/src/datasets_preview_backend/io/asset.py b/src/datasets_preview_backend/io/asset.py index a74f08e06..58783a35d 100644 --- a/src/datasets_preview_backend/io/asset.py +++ b/src/datasets_preview_backend/io/asset.py @@ -13,7 +13,7 @@ logger = logging.getLogger(__name__) DATASET_SEPARATOR = "--" -ASSET_DIR_MODE = 755 +ASSET_DIR_MODE = 0o755 # set it to the default cache location on the machine, if ASSETS_DIRECTORY is null assets_directory = user_cache_dir("datasets_preview_backend_assets") if ASSETS_DIRECTORY is None else ASSETS_DIRECTORY