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

X-Accel-Redirect with non-ascii filenames #1448

Closed
fle opened this issue Jan 30, 2017 · 3 comments
Closed

X-Accel-Redirect with non-ascii filenames #1448

fle opened this issue Jan 30, 2017 · 3 comments

Comments

@fle
Copy link

fle commented Jan 30, 2017

Since the 19.4 release and this commit : #1151, it seems like using X-Accel-Redirect with a non-ascii URI is not possible anymore.

Though RFC 7230 says that http headers should be encoded in USASCII, shouldn't have we an exception for this kind of header? Without it, X-Accel-Redirect function is not available since we have files with a non-ascii filename.

Furthermore, it's curious that nginx still has a X-Accel-Charset utf-8 by default.

Thanks for reading this,

@dracos
Copy link

dracos commented May 21, 2017

You provide a URI in X-Accel-Redirect, not a filename, so can you not %-encode the filename first, as you normally would for a URI? For example, with the nginx docs example of location /protected_files { internal; root /var/www; }, and a file at /var/www/protected_files/café.png, an X-Accel-Redirect header of /protected_files/caf%c3%a9.png works fine.

X-Accel-Charset is for the content type of the file, not the headers.

@tilgovi
Copy link
Collaborator

tilgovi commented Jul 11, 2017

@fle does the comment above help you or is this still an issue?

@Eugeny
Copy link

Eugeny commented Jul 9, 2018

I had this problem and quoting the complete header value worker for me

humitos added a commit to readthedocs/readthedocs.org that referenced this issue Dec 20, 2018
Filepath can contains non-ASCII characters, so we need to convert to a
valid URI before setting it as X-Accel-Redirec NGINX header because
only ASCII characters are supported.

References,

* https://docs.djangoproject.com/en/1.11/ref/unicode/#uri-and-iri-handling
* benoitc/gunicorn#1448
humitos added a commit to readthedocs/readthedocs.org that referenced this issue Jan 3, 2019
Filepath can contains non-ASCII characters, so we need to convert to a
valid URI before setting it as X-Accel-Redirec NGINX header because
only ASCII characters are supported.

References,

* https://docs.djangoproject.com/en/1.11/ref/unicode/#uri-and-iri-handling
* benoitc/gunicorn#1448
humitos added a commit to readthedocs/readthedocs.org that referenced this issue Jan 7, 2019
Filepath can contains non-ASCII characters, so we need to convert to a
valid URI before setting it as X-Accel-Redirec NGINX header because
only ASCII characters are supported.

References,

* https://docs.djangoproject.com/en/1.11/ref/unicode/#uri-and-iri-handling
* benoitc/gunicorn#1448
humitos added a commit to readthedocs/readthedocs.org that referenced this issue Jan 7, 2019
Filepath can contains non-ASCII characters, so we need to convert to a
valid URI before setting it as X-Accel-Redirec NGINX header because
only ASCII characters are supported.

References,

* https://docs.djangoproject.com/en/1.11/ref/unicode/#uri-and-iri-handling
* benoitc/gunicorn#1448
@benoitc benoitc closed this as completed Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants