Skip to content

Commit

Permalink
Use FileResponse if no _app_prefix (#16020)
Browse files Browse the repository at this point in the history
## Summary & Motivation

Use FileResponse so the browser caches javascript responses. I need to
set the proper headers even when there is an app_path_prefix so that
they're cached for OSS users but I'll tackle that next time, for now I
want to fix this for cloud.

## How I Tested These Changes

Locally made sure files are cached

<img width="844" alt="Screenshot 2023-08-22 at 4 25 36 PM"
src="https://github.com/dagster-io/dagster/assets/2286579/faa024f6-10a4-4f7b-809b-9fb5a4507cc6">
  • Loading branch information
salazarm authored Aug 22, 2023
1 parent 271c126 commit 6149c01
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def _static_file(path, file_path):
full_path = path.join(subdir, file)
relative_path = "/" + full_path[len(base_dir) :].lstrip(path.sep)
# We only need to replace BUILDTIME_ASSETPREFIX_REPLACE_ME in javascript files
if file.endswith(".js") or file.endswith(".js.map"):
if self._app_path_prefix and (file.endswith(".js") or file.endswith(".js.map")):
routes.append(_next_static_file(relative_path, full_path))
else:
routes.append(_static_file(relative_path, full_path))
Expand Down

0 comments on commit 6149c01

Please sign in to comment.