internetstandards / Internet.nl

Internet standards compliance test suite
https://internet.nl
164 stars 36 forks source link

Pictures not loaded in news items #1441

Closed baknu closed 1 week ago

baknu commented 2 weeks ago

In some news items (articles) pictures are not loaded. See for example: https://internet.nl/article/stilstand-is-achteruitgang/

bwbroersma commented 1 week ago

Note this is a Dutch-article only, so https://nl.internet.nl/article/stilstand-is-achteruitgang/ is the correct permalink here. See the related issue:

In this case: /static/author//marco-davids/picture.jpg 404's, while /static/author/marco-davids/picture.jpg does not.

The problem lies here: https://github.com/internetstandards/Internet.nl/blob/4ceeabadcc11b2a06374310b6b598b25c971dde2/interface/templates/article.html#L12

Either the trailing slash of '/author/' or the starting slash of /{{author}}/picture.jpg should be removed.


It might be due to the change from Apache to Nginx. Although the Nginx merge_slashes by default is on, the content is actually served by the Django Middleware WhiteNoise: https://github.com/internetstandards/Internet.nl/blob/4ceeabadcc11b2a06374310b6b598b25c971dde2/internetnl/settings.py#L177-L179

This is done via: https://github.com/internetstandards/Internet.nl/blob/4ceeabadcc11b2a06374310b6b598b25c971dde2/docker/webserver/nginx_templates/app.conf.template#L269 A proxy_pass that:

is specified without a URI, the request URI is passed to the server in the same form as sent by a client when the original request is processed, or the full normalized request URI is passed when processing the changed URI

So the 'trick' might also be to make it an URI, by adding a trailing / here. However the first solution should be preferred.

BTW this should/could have been caught by checking the server side 404's.