How do I proxy a file in Apache based on its MIME type? I want to use PHP-FPM with FastCGI but the recommended solution using ProxyPassMatch
is clunky, a pain to work with, and all around unfavorable. How would I go about proxying based on MIME type instead?
Asked
Active
Viewed 374 times
0

robbie
- 101
-
It is not clunky, why do you say that? You just need to use PCRE to specify what you want to pass onto fpm. – Daniel Ferradal Feb 01 '17 at 10:30
-
@ezra-s I find it clunky mainly because you can't force a folder as `text/plain` to not process the PHP. – robbie Feb 01 '17 at 12:43
-
I don't follow, proxypassmatch is used to specify paths/uri with regex, not mime/types. – Daniel Ferradal Feb 01 '17 at 13:36
-
@ezra-s The wiki recommends proxypassmatch, but I don't want to use proxypassmatch. – robbie Feb 01 '17 at 16:43
-
well, see the handler answer I gave you earlier. – Daniel Ferradal Feb 01 '17 at 17:03
1 Answers
0
You can also use the handler method (2.4.10 onwards):
<FilesMatch \.php>
SetHandler "proxy:unix:/path/to/app.sock|fcgi://localhost/"
</FilesMatch>

Daniel Ferradal
- 2,415
- 1
- 8
- 13