Apache 2.4 compression not working when using alias and reverse proxyDifference between proxy server and reverse proxy serverHow to serve compressed/uncompressed files based on request's accepted encoding types by having only compressed filesHandle GZip compression on Apache 2.4.18 using mod_jkApache to tomcat proxy is not workingCGI script in Apache 2.4 runs but returns empty response?Amazon Elastic Beanstalk, Angular-cli build gzip compression, Nginx, Pagespeed insight says its not compressingkibana apache proxy failedHow to call a shell script from Apache?Apache Gzip is not working for json fileUsing Output Filters WITH Reverse Proxy on Apache 2.4

What Armor Optimization applies to a Mithral full plate?

How does the EU Emissions Trading Scheme account for increased emissions outside the EU?

I know that there is a preselected candidate for a position to be filled at my department. What should I do?

Why is the Eisenstein ideal paper so great?

Why didn't Thanos use the Time Stone to stop the Avengers' plan?

Is my plasma cannon concept viable?

Why haven't we yet tried accelerating a space station with people inside to a near light speed?

Parallel fifths in the orchestra

Is it legal to meet with potential future employers in the UK, whilst visiting from the USA

Why did Drogon spare this character?

Why does this if statement return true

Shorten or merge multiple lines of `&> /dev/null &`

Why would a rational buyer offer to buy with no conditions precedent?

What is the meaning of "<&3" and "done < file11 3< file22"

The art of clickbait captions

Did this character show any indication of wanting to rule before S8E6?

What is the use case for non-breathable waterproof pants?

Is this statement about cut time correct?

Why isn't Tyrion mentioned in the in-universe book "A Song of Ice and Fire"?

Why did Theresa May offer a vote on a second Brexit referendum?

Take elements from a list based on two criteria

Did 20% of US soldiers in Vietnam use heroin, 95% of whom quit afterwards?

Mysterious procedure calls without parameters - but no exceptions generated

Security vulnerabilities of POST over SSL



Apache 2.4 compression not working when using alias and reverse proxy


Difference between proxy server and reverse proxy serverHow to serve compressed/uncompressed files based on request's accepted encoding types by having only compressed filesHandle GZip compression on Apache 2.4.18 using mod_jkApache to tomcat proxy is not workingCGI script in Apache 2.4 runs but returns empty response?Amazon Elastic Beanstalk, Angular-cli build gzip compression, Nginx, Pagespeed insight says its not compressingkibana apache proxy failedHow to call a shell script from Apache?Apache Gzip is not working for json fileUsing Output Filters WITH Reverse Proxy on Apache 2.4






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Problem:
I have an alias directory for a url sub path that pulls static data. I can get this to gzip compress just fine. However, when I add proxy to other paths and add an exception for my static data, compression stops.



Environment



  • Windows x64

  • Apache 2.4

Key Configuration in httpd.conf



<Directory "$SRVROOT/static">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>

# I have used FilterProvider as well an know this just does javascript at the moment
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
SetOutputFilter DEFLATE

<IfModule alias_module>
Alias "/static" "$SRVROOT/static"
ScriptAlias /cgi-bin/ "$SRVROOT/cgi-bin/"
</IfModule>


With this configuration and a "static" folder under SRVROOT, I place a file bundle.js (3M of data). Polling this file at http://localhost/static/bundle.js gives me 600K of download with gzip compression. ALL GOOD



Now for the change. The default path of the app needs to reverse proxy to another application and apache is just serving up static content.



<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>


extra/proxy-html.conf file content



#default proxy stuff above...
ProxyRequests off
ProxyPass / http://localhost:5000/
#ProxyPass /static/ /
ProxyHTMLURLMap http://localhost:5000/ /

<Location />
ProxyPassReverse /
ProxyHTMLEnable On
ProxyHTMLURLMap / /
RequestHeader unset Accept-Encoding
</Location>

<Location /static/ >
ProxyPass !
</Location>


This still allows me to hit my static data, only now the gzip compression is not happening. I do not know if this is a bug in apache or if there is a better way to configure this.



Here are my requirements:



  • I cannot change the pathing of the url (static is where it is, and root url content gets reverse proxied

  • I need compression

  • Deployment is to a root folder that honestly is not named static, so the fact that I route (in this example) static to some directory/static it is really http://localhost/static/* to a dist folder in all actuality.









share|improve this question






























    0















    Problem:
    I have an alias directory for a url sub path that pulls static data. I can get this to gzip compress just fine. However, when I add proxy to other paths and add an exception for my static data, compression stops.



    Environment



    • Windows x64

    • Apache 2.4

    Key Configuration in httpd.conf



    <Directory "$SRVROOT/static">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
    </Directory>

    # I have used FilterProvider as well an know this just does javascript at the moment
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
    SetOutputFilter DEFLATE

    <IfModule alias_module>
    Alias "/static" "$SRVROOT/static"
    ScriptAlias /cgi-bin/ "$SRVROOT/cgi-bin/"
    </IfModule>


    With this configuration and a "static" folder under SRVROOT, I place a file bundle.js (3M of data). Polling this file at http://localhost/static/bundle.js gives me 600K of download with gzip compression. ALL GOOD



    Now for the change. The default path of the app needs to reverse proxy to another application and apache is just serving up static content.



    <IfModule proxy_html_module>
    Include conf/extra/proxy-html.conf
    </IfModule>


    extra/proxy-html.conf file content



    #default proxy stuff above...
    ProxyRequests off
    ProxyPass / http://localhost:5000/
    #ProxyPass /static/ /
    ProxyHTMLURLMap http://localhost:5000/ /

    <Location />
    ProxyPassReverse /
    ProxyHTMLEnable On
    ProxyHTMLURLMap / /
    RequestHeader unset Accept-Encoding
    </Location>

    <Location /static/ >
    ProxyPass !
    </Location>


    This still allows me to hit my static data, only now the gzip compression is not happening. I do not know if this is a bug in apache or if there is a better way to configure this.



    Here are my requirements:



    • I cannot change the pathing of the url (static is where it is, and root url content gets reverse proxied

    • I need compression

    • Deployment is to a root folder that honestly is not named static, so the fact that I route (in this example) static to some directory/static it is really http://localhost/static/* to a dist folder in all actuality.









    share|improve this question


























      0












      0








      0








      Problem:
      I have an alias directory for a url sub path that pulls static data. I can get this to gzip compress just fine. However, when I add proxy to other paths and add an exception for my static data, compression stops.



      Environment



      • Windows x64

      • Apache 2.4

      Key Configuration in httpd.conf



      <Directory "$SRVROOT/static">
      Options Indexes FollowSymLinks
      AllowOverride None
      Require all granted
      </Directory>

      # I have used FilterProvider as well an know this just does javascript at the moment
      AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
      SetOutputFilter DEFLATE

      <IfModule alias_module>
      Alias "/static" "$SRVROOT/static"
      ScriptAlias /cgi-bin/ "$SRVROOT/cgi-bin/"
      </IfModule>


      With this configuration and a "static" folder under SRVROOT, I place a file bundle.js (3M of data). Polling this file at http://localhost/static/bundle.js gives me 600K of download with gzip compression. ALL GOOD



      Now for the change. The default path of the app needs to reverse proxy to another application and apache is just serving up static content.



      <IfModule proxy_html_module>
      Include conf/extra/proxy-html.conf
      </IfModule>


      extra/proxy-html.conf file content



      #default proxy stuff above...
      ProxyRequests off
      ProxyPass / http://localhost:5000/
      #ProxyPass /static/ /
      ProxyHTMLURLMap http://localhost:5000/ /

      <Location />
      ProxyPassReverse /
      ProxyHTMLEnable On
      ProxyHTMLURLMap / /
      RequestHeader unset Accept-Encoding
      </Location>

      <Location /static/ >
      ProxyPass !
      </Location>


      This still allows me to hit my static data, only now the gzip compression is not happening. I do not know if this is a bug in apache or if there is a better way to configure this.



      Here are my requirements:



      • I cannot change the pathing of the url (static is where it is, and root url content gets reverse proxied

      • I need compression

      • Deployment is to a root folder that honestly is not named static, so the fact that I route (in this example) static to some directory/static it is really http://localhost/static/* to a dist folder in all actuality.









      share|improve this question
















      Problem:
      I have an alias directory for a url sub path that pulls static data. I can get this to gzip compress just fine. However, when I add proxy to other paths and add an exception for my static data, compression stops.



      Environment



      • Windows x64

      • Apache 2.4

      Key Configuration in httpd.conf



      <Directory "$SRVROOT/static">
      Options Indexes FollowSymLinks
      AllowOverride None
      Require all granted
      </Directory>

      # I have used FilterProvider as well an know this just does javascript at the moment
      AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
      SetOutputFilter DEFLATE

      <IfModule alias_module>
      Alias "/static" "$SRVROOT/static"
      ScriptAlias /cgi-bin/ "$SRVROOT/cgi-bin/"
      </IfModule>


      With this configuration and a "static" folder under SRVROOT, I place a file bundle.js (3M of data). Polling this file at http://localhost/static/bundle.js gives me 600K of download with gzip compression. ALL GOOD



      Now for the change. The default path of the app needs to reverse proxy to another application and apache is just serving up static content.



      <IfModule proxy_html_module>
      Include conf/extra/proxy-html.conf
      </IfModule>


      extra/proxy-html.conf file content



      #default proxy stuff above...
      ProxyRequests off
      ProxyPass / http://localhost:5000/
      #ProxyPass /static/ /
      ProxyHTMLURLMap http://localhost:5000/ /

      <Location />
      ProxyPassReverse /
      ProxyHTMLEnable On
      ProxyHTMLURLMap / /
      RequestHeader unset Accept-Encoding
      </Location>

      <Location /static/ >
      ProxyPass !
      </Location>


      This still allows me to hit my static data, only now the gzip compression is not happening. I do not know if this is a bug in apache or if there is a better way to configure this.



      Here are my requirements:



      • I cannot change the pathing of the url (static is where it is, and root url content gets reverse proxied

      • I need compression

      • Deployment is to a root folder that honestly is not named static, so the fact that I route (in this example) static to some directory/static it is really http://localhost/static/* to a dist folder in all actuality.






      apache gzip alias reverse-proxy






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 24 at 1:19







      Chewy

















      asked Mar 24 at 1:11









      ChewyChewy

      507319




      507319






















          1 Answer
          1






          active

          oldest

          votes


















          0














          It appears that RequestHeader unset Accept-Encoding is bleeding over into the other Location definition. This seems like it should not be expected behavior. There appears to be two solutions to the problem.



          1. Remove the ProxyHTMLURLMap and RequestHeader unset Accept-Encoding as this needs to uncompress the content
            to do the url rewriting.

          2. Inflate and Deflate the content. I have yet to determine of this will inflate and deflate the static content on the server. The only reason I mention this is because the usetting of the Accept-Encoding seemed to bleed over into the static section. -- Not sure how to test this yet.

          Example of removing ProxyURLMap



          ProxyRequests off
          ProxyPass / http://localhost:5000/
          ProxyPassReverse / http://localhost:5000/

          <Location /static/ >
          ProxyPass !
          </Location>

          #Do not use this anymore
          #<Location />
          # ProxyPassReverse /
          # ProxyHTMLEnable On
          # ProxyHTMLURLMap / /
          # RequestHeader unset Accept-Encoding
          #</Location>


          Example of using the INFLATE;DEFLATE



          ProxyRequests off
          ProxyPass / http://localhost:5000/
          ProxyPassReverse / http://localhost:5000/

          <Location />
          ProxyPassReverse /
          ProxyHTMLEnable On
          ProxyHTMLURLMap / /
          SetOutputFilter INFLATE;DEFLATE
          </Location>

          <Location /static/ >
          ProxyPass !
          </Location>





          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55319873%2fapache-2-4-compression-not-working-when-using-alias-and-reverse-proxy%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            It appears that RequestHeader unset Accept-Encoding is bleeding over into the other Location definition. This seems like it should not be expected behavior. There appears to be two solutions to the problem.



            1. Remove the ProxyHTMLURLMap and RequestHeader unset Accept-Encoding as this needs to uncompress the content
              to do the url rewriting.

            2. Inflate and Deflate the content. I have yet to determine of this will inflate and deflate the static content on the server. The only reason I mention this is because the usetting of the Accept-Encoding seemed to bleed over into the static section. -- Not sure how to test this yet.

            Example of removing ProxyURLMap



            ProxyRequests off
            ProxyPass / http://localhost:5000/
            ProxyPassReverse / http://localhost:5000/

            <Location /static/ >
            ProxyPass !
            </Location>

            #Do not use this anymore
            #<Location />
            # ProxyPassReverse /
            # ProxyHTMLEnable On
            # ProxyHTMLURLMap / /
            # RequestHeader unset Accept-Encoding
            #</Location>


            Example of using the INFLATE;DEFLATE



            ProxyRequests off
            ProxyPass / http://localhost:5000/
            ProxyPassReverse / http://localhost:5000/

            <Location />
            ProxyPassReverse /
            ProxyHTMLEnable On
            ProxyHTMLURLMap / /
            SetOutputFilter INFLATE;DEFLATE
            </Location>

            <Location /static/ >
            ProxyPass !
            </Location>





            share|improve this answer





























              0














              It appears that RequestHeader unset Accept-Encoding is bleeding over into the other Location definition. This seems like it should not be expected behavior. There appears to be two solutions to the problem.



              1. Remove the ProxyHTMLURLMap and RequestHeader unset Accept-Encoding as this needs to uncompress the content
                to do the url rewriting.

              2. Inflate and Deflate the content. I have yet to determine of this will inflate and deflate the static content on the server. The only reason I mention this is because the usetting of the Accept-Encoding seemed to bleed over into the static section. -- Not sure how to test this yet.

              Example of removing ProxyURLMap



              ProxyRequests off
              ProxyPass / http://localhost:5000/
              ProxyPassReverse / http://localhost:5000/

              <Location /static/ >
              ProxyPass !
              </Location>

              #Do not use this anymore
              #<Location />
              # ProxyPassReverse /
              # ProxyHTMLEnable On
              # ProxyHTMLURLMap / /
              # RequestHeader unset Accept-Encoding
              #</Location>


              Example of using the INFLATE;DEFLATE



              ProxyRequests off
              ProxyPass / http://localhost:5000/
              ProxyPassReverse / http://localhost:5000/

              <Location />
              ProxyPassReverse /
              ProxyHTMLEnable On
              ProxyHTMLURLMap / /
              SetOutputFilter INFLATE;DEFLATE
              </Location>

              <Location /static/ >
              ProxyPass !
              </Location>





              share|improve this answer



























                0












                0








                0







                It appears that RequestHeader unset Accept-Encoding is bleeding over into the other Location definition. This seems like it should not be expected behavior. There appears to be two solutions to the problem.



                1. Remove the ProxyHTMLURLMap and RequestHeader unset Accept-Encoding as this needs to uncompress the content
                  to do the url rewriting.

                2. Inflate and Deflate the content. I have yet to determine of this will inflate and deflate the static content on the server. The only reason I mention this is because the usetting of the Accept-Encoding seemed to bleed over into the static section. -- Not sure how to test this yet.

                Example of removing ProxyURLMap



                ProxyRequests off
                ProxyPass / http://localhost:5000/
                ProxyPassReverse / http://localhost:5000/

                <Location /static/ >
                ProxyPass !
                </Location>

                #Do not use this anymore
                #<Location />
                # ProxyPassReverse /
                # ProxyHTMLEnable On
                # ProxyHTMLURLMap / /
                # RequestHeader unset Accept-Encoding
                #</Location>


                Example of using the INFLATE;DEFLATE



                ProxyRequests off
                ProxyPass / http://localhost:5000/
                ProxyPassReverse / http://localhost:5000/

                <Location />
                ProxyPassReverse /
                ProxyHTMLEnable On
                ProxyHTMLURLMap / /
                SetOutputFilter INFLATE;DEFLATE
                </Location>

                <Location /static/ >
                ProxyPass !
                </Location>





                share|improve this answer















                It appears that RequestHeader unset Accept-Encoding is bleeding over into the other Location definition. This seems like it should not be expected behavior. There appears to be two solutions to the problem.



                1. Remove the ProxyHTMLURLMap and RequestHeader unset Accept-Encoding as this needs to uncompress the content
                  to do the url rewriting.

                2. Inflate and Deflate the content. I have yet to determine of this will inflate and deflate the static content on the server. The only reason I mention this is because the usetting of the Accept-Encoding seemed to bleed over into the static section. -- Not sure how to test this yet.

                Example of removing ProxyURLMap



                ProxyRequests off
                ProxyPass / http://localhost:5000/
                ProxyPassReverse / http://localhost:5000/

                <Location /static/ >
                ProxyPass !
                </Location>

                #Do not use this anymore
                #<Location />
                # ProxyPassReverse /
                # ProxyHTMLEnable On
                # ProxyHTMLURLMap / /
                # RequestHeader unset Accept-Encoding
                #</Location>


                Example of using the INFLATE;DEFLATE



                ProxyRequests off
                ProxyPass / http://localhost:5000/
                ProxyPassReverse / http://localhost:5000/

                <Location />
                ProxyPassReverse /
                ProxyHTMLEnable On
                ProxyHTMLURLMap / /
                SetOutputFilter INFLATE;DEFLATE
                </Location>

                <Location /static/ >
                ProxyPass !
                </Location>






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 29 at 19:58

























                answered Mar 24 at 22:58









                ChewyChewy

                507319




                507319





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55319873%2fapache-2-4-compression-not-working-when-using-alias-and-reverse-proxy%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript