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 298 times
0
![](../../users/profiles/299431.webp)
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. – ezra-s 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. – ezra-s 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. – ezra-s 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>
![](../../users/profiles/368782.webp)
ezra-s
- 2,215
- 1
- 7
- 13