logo
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Register Log in  RSS Apache Lounge
 



Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.



Apache .htaccess RewriteRule discards config directive

 
Post new topic   Reply to topic    Apache Forum Index -> Apache



View previous topic :: View next topic  
Author Message
SuperRey



Joined: 12 Jul 2017
Posts: 2

PostPosted: Wed 19 Jul '17 12:38    Post subject: Apache .htaccess RewriteRule discards config directive Reply with quote

I have configured my apache installation to accept a gzipped body on http requests. I did this by adding in the main apache configuration file the following lines:

Code:
<IfModule mod_deflate.c>
     <IfModule mod_filter.c>
         SetInputFilter DEFLATE
    </IfModule>
</IfModule>


It works as expected except in the case that a matching RewriteRule directive is found, but I am not sure if I am missing something in my configuration or this is a bug or unexpected behaviour.

My test suite is the following:

The folder/file structure is:

Code:
/.htaccess
/test.php
/api/web/index.php


And the contents of the .htaccess is:

Code:
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^api(.*)$ api/web/index.php [L]


The PHP files just outputs the body contents for testing.

POSTing to /test.php or /api/web/index.php with a compressed body works as expected, decompressing the request body correctly.

POSTing to /api/, /api/web/ or /api/web/something (that is any request to api/* will get redirected to /api/web/index.php) does not get the body decompressed.

Can anybody point to me what I am missing?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6202
Location: Germany, Next to Hamburg

PostPosted: Sun 23 Jul '17 17:07    Post subject: Reply with quote

It is not InputFiler but OutputFilter

AddOutputFilter or AddOutputFilterByType

example

[code]
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/php text/css text/js text/javascript text/javascript-x application/x-javascript font/truetype
AddOutputFilterByType DEFLATE application/javascript application/rss+xml
DeflateCompressionLevel 9
</IfModule>
Back to top
SuperRey



Joined: 12 Jul 2017
Posts: 2

PostPosted: Sun 23 Jul '17 18:21    Post subject: Reply with quote

Hello James Blond,

Thanks for answering.

Just to be sure, do you mean that in order to make my apache installation being able to accept http gzip compressed body requests I have to use AddOutputFilter instead of AddInputFilter?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 6202
Location: Germany, Next to Hamburg

PostPosted: Thu 03 Aug '17 19:32    Post subject: Reply with quote

Sorry I got that wrong. AddInputFilter is right for that.
Back to top


Post new topic   Reply to topic    Apache Forum Index -> Apache
Page 1 of 1