Changes between Initial Version and Version 2 of Ticket #2373


Ignore:
Timestamp:
07/29/22 14:22:17 (21 months ago)
Author:
Maxim Dounin
Comment:

That's because spaces are not allowed in request URIs, and since nginx 1.21.1 these are rejected. Quoting CHANGES:

    *) Change: now nginx always returns an error if spaces or control
       characters are used in the request line.

See ticket #196 for details.

Your configuration results in incorrect URIs being used during proxying, as it uses named captures from $uri, which is unescaped, in proxy_pass, which expects all variables to be properly escaped if used with variables.

As far as I can see, in your configuration the most simple fix would be to change all proxy_pass directives to don't use any URI components, that is:

location ~ "/width/(?<width>\d+)/(?<image>.+)$" {
    proxy_pass http://localhost:8888;
    proxy_cache thumbnails;
    proxy_cache_valid 200 24h;
}

This way, nginx will pass URIs from the client request unmodified (and properly escaped), and these match URIs you've been trying to reconstruct with variables.

Hope this helps.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2373

    • Property Status newclosed
    • Property Resolutioninvalid
  • Ticket #2373 – Description

    initial v2  
    1212When the request fails the user agent is missing from "nginx-thumbnails-localhost-access.log" (no idea if that's relevant).
    1313
     14{{{
    1415server {
    1516    # Internal image resizing server.
     
    8889    }
    8990}
     91}}}
    9092
    9193A test for this error can be created very easily, I did so on an Ubuntu 22 Digital Ocean Droplet.