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

mod_magick and filters not applied after mod_wsgi app returns from request #1

Closed
bpluly opened this issue Apr 6, 2021 · 4 comments
Closed

Comments

@bpluly
Copy link

bpluly commented Apr 6, 2021

This may well have nothing to do with mod_magick et al.
I have the following two blocks of config.

   <FilesMatch ".+\.(tiff|tif)$">
      <If "%{QUERY_STRING} =~ /./">
        Header set ImageFilter "Magick FORMAT"
        SetOutputFilter MAGICK;MAGICK_FORMAT
        MagickFormat PNG
      </If>
    </FilesMatch>
    
    <FilesMatch ".+\.(gif|jpe?g|png)$">
      SetOutputFilter MAGICK;MAGICK_RESIZE
      Header set ImageFilter "Magick RESIZE"      
      MagickResizeColumns 100 %{QUERY_STRING}
      <If "%{req:Width} != ''">
        MagickResizeColumns %{req:Width}
      </If>
    </FilesMatch>    

In a vanilla site config, with SSL but without WSGIDAEMON etc, this works as advertised. The VARY header is set, the ImageFilter is set and any .tiff is converted. The config is all within the Directory Block aliased on DocumentRoot (/var/www/html)

With the WSGIDAEMON regardless whether it's in a Directory Block or just in the VirtualHost the config is not executed.

As I say this may well have nothing to do with the WSGI and the app but I thought that WSGI passed on the response to the regular chain. That said the only logging I get is if the app breaks. That hasn't concerned me so far I do my own access logging but it may mean the Response is avoiding the regular chain.

If I figure it out in the meantime I'll update.

Otherwise, it's all good.

Ta

S

@minfrin
Copy link
Owner

minfrin commented Apr 6, 2021

Using <Directory> (and <Files>) only covers files served off disk, if they're dynamic they need to be in a <Location>.

I suspect what's happening is that the config doesn't apply (to a non directory), the filter(s) isn't inserted, and nothing happens.

Looks like we need a debug level message to confirm the MAGICK filter has been inserted, so there isn't a wall of silence.

@minfrin
Copy link
Owner

minfrin commented Apr 6, 2021

Try this to add a debug message:

#2

@bpluly
Copy link
Author

bpluly commented Apr 7, 2021

I added the header ImageFilter to do a similar thing.

@bpluly
Copy link
Author

bpluly commented Apr 7, 2021

Building with the debug logline confirms that if the is true then mod_magick is called. So as suspected it;s nothing to do with mod_magick.

Just a note, to build (on AWS Linux 2) I needed to autoreconf for a working ./configure

@bpluly bpluly closed this as completed Apr 12, 2021
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

No branches or pull requests

2 participants