Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support serving files directly #248

Merged
merged 1 commit into from
Aug 22, 2024
Merged

Support serving files directly #248

merged 1 commit into from
Aug 22, 2024

Conversation

Szaki
Copy link
Contributor

@Szaki Szaki commented Aug 21, 2024

This PR adds the Boolean option serve_directly to BinderFileField and BinderImageField, with the default value False.

When set to True, a special header is added to HTTP responses that delegates the serving of the affected files to the web server (e.g. Nginx).

@Szaki Szaki force-pushed the file_serve_direct branch from 9a16b32 to 3de11c9 Compare August 21, 2024 12:40
Copy link
Contributor

@BBooijLiewes BBooijLiewes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remarks

  • Replace the redirect URL with an env setting with default
  • Test header X-Accel-Redirect being added or not depending on serve_directly setting
  • Add documentation

binder/views.py Outdated Show resolved Hide resolved
tests/test_binder_file_field.py Outdated Show resolved Hide resolved
@Szaki Szaki force-pushed the file_serve_direct branch 7 times, most recently from 4549e30 to 1dc9889 Compare August 22, 2024 13:41
@Szaki Szaki force-pushed the file_serve_direct branch from 1dc9889 to fad535a Compare August 22, 2024 15:18
@BBooijLiewes BBooijLiewes merged commit 1c88182 into master Aug 22, 2024
8 checks passed
@Szaki Szaki deleted the file_serve_direct branch August 22, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants