mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
[ticket/9790] Support for nginx's X-Accel-Redirect header for attachments.
PHPBB3-9790
This commit is contained in:
parent
19931713db
commit
6bbdc129c0
2 changed files with 18 additions and 0 deletions
|
@ -3,6 +3,14 @@
|
|||
# from your system's nginx.conf.
|
||||
# Tested with nginx 0.8.35.
|
||||
|
||||
# If you want to use the X-Accel-Redirect feature,
|
||||
# add the following to your config.php.
|
||||
#
|
||||
# define('PHPBB_ENABLE_X_ACCEL_REDIRECT', true);
|
||||
#
|
||||
# See http://wiki.nginx.org/XSendfile for the details
|
||||
# on X-Accel-Redirect.
|
||||
|
||||
http {
|
||||
# Compression - requires gzip and gzip static modules.
|
||||
gzip on;
|
||||
|
|
|
@ -229,6 +229,16 @@ function send_file_to_browser($attachment, $upload_dir, $category)
|
|||
|
||||
if (!set_modified_headers($attachment['filetime'], $user->browser))
|
||||
{
|
||||
// We make sure those have to be enabled manually by defining a constant
|
||||
// because of the potential disclosure of full attachment path
|
||||
// in case support for features is absent in the webserver software.
|
||||
if (defined('PHPBB_ENABLE_X_ACCEL_REDIRECT') && PHPBB_ENABLE_X_ACCEL_REDIRECT)
|
||||
{
|
||||
// X-Accel-Redirect - http://wiki.nginx.org/XSendfile
|
||||
header('X-Accel-Redirect: ' . $user->page['root_script_path'] . $upload_dir . '/' . $attachment['physical_filename']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Try to deliver in chunks
|
||||
@set_time_limit(0);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue