gzip working fine on xampp Windows, but not on same Xampp Li

Problems with the Linux version of XAMPP, questions, comments, and anything related.

gzip working fine on xampp Windows, but not on same Xampp Li

Postby marcvdm » 21. January 2012 11:47

gzip working fine on xampp Windows, but not on same Xampp Linux

Hello,

I managed to gzip a file of the extjs framework (ext-all.js) on my local machine (running xampp 1.7.4 and serving everything by https).
Checking headers (content encoding: gzip is indeed showing up) and document size in FF using developer toolbar shows the Apache server is indeed serving the precompressed ext-all.js.gzip file, and it's working ok.

Strangely enough, the same setup is not working at all on a Suse Linux box, using the same Xampp version (apart from being the Linux version), same .htaccess file, same headers, same precompressed file, also https etc...
In this case, for some reason Apache is not sending the Content encoding : gzip header.
Any ideas where to look first ?

Best regards,

Marc
marcvdm
 
Posts: 6
Joined: 21. January 2012 11:44
XAMPP Version: 1.8.3-3
Operating System: windows and linux

Re: gzip working fine on xampp Windows, but not on same Xamp

Postby JonB » 21. January 2012 17:44

I don't have access to my LAMPP box right now, so I can't test anything.

BUT here are a couple of links for you

http://httpd.apache.org/docs/2.0/mod/mod_deflate.html

http://betterexplained.com/articles/how ... mpression/

http://developer.yahoo.com/performance/rules.html

I might start by seeing if enabling mod_deflate in /opt/lampp/etc/httpd.conf will turn the trick.

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
XAMPP Version: 1.8.3-2
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: gzip working fine on xampp Windows, but not on same Xamp

Postby marcvdm » 29. January 2012 16:09

Hello JonB,

Thanks for the reply. I had already seen the articles in the links, actually I used them to set up the whole thing.
Mod_deflate is loaded by Apache, this I can confirm both by phpinfo() and by looking into the httpd.conf file.

So apache should send the appropriate header, which it does under Windows, but not under Linux (Suse 11.4).
I use the same Firfox instance in both cases.
marcvdm
 
Posts: 6
Joined: 21. January 2012 11:44
XAMPP Version: 1.8.3-3
Operating System: windows and linux

Re: gzip working fine on xampp Windows, but not on same Xamp

Postby JonB » 30. January 2012 17:26

Did you use firebug??? (i'm guessing yes) Does it 'not serve' the page at all?? (I'm guessing yes).

What actually happens when you make the request???

Did you look in the Apache error log???

I do have a suggestion, try setting up a plain HTML page in the root of htdocs (ensuring there is no .htaccess file 1st). See what Apache does with that. IF Apache compresses it (HTML) AND serves it - the problem is likely with a MIME type setting. (my current guess)

If your server is available via an external connection, PM me the information for it.

I am going to work on a project on my LAMPP box this week, its running 1.7.4 - I'll do a test to see if it is working correctly. I have some js code libraries I can experiment with.

Thanks and good luck.
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
XAMPP Version: 1.8.3-2
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: gzip working fine on xampp Windows, but not on same Xamp

Postby marcvdm » 30. January 2012 20:39

Hello JonB,

- Yes, I use Firebug, and also LiveHTTPHeaders.
- Apache is actually serving the content. It's a precompressed file.
- On Windows this content is serverd with a "content encoding: gzip" header, so Firefox decompresses correctly and everything is working ok there.
- On Linux, the content is also serverd, but the header is missing, so Firefox does not decompress it and shows only bogus characters.

Until now , I can't figure out why Windows is sending the header and Linux is not. In both cases, mod_deflate is loaded. And both use the same htaccess files (the second one is actually a copy of the first one).

The server is not available on an external connection unfortunately.

Best regards, Marc
marcvdm
 
Posts: 6
Joined: 21. January 2012 11:44
XAMPP Version: 1.8.3-3
Operating System: windows and linux

Re: gzip working fine on xampp Windows, but not on same Xamp

Postby JonB » 30. January 2012 22:31

OK, that's good info

I see I misunderstood one thing - you are on 1.7.4 in both installs.

Is the javascript call embedded in Code or HTML??? -- that is to say dynamic or static pages??

I have a 'glimmering' in the mind about an issue. (but it is waaay speculative at this point) :roll:

I do have a question that is a bit off topic, but I am curious -- In your code, what happens if a browser request does not contain: Accept-Encoding: gzip, deflate?

I am working on Linux projects this week, I'll see what I can find out.

Good Luck and keep me posted, I love a mystery. :lol:

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
XAMPP Version: 1.8.3-2
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: gzip working fine on xampp Windows, but not on same Xamp

Postby marcvdm » 02. February 2012 11:36

Hello JonB,

- Yes, 1.7.4 in both installs

- The final result is a dynamic page (using Extjs, which produces a lot of Ajax calls), but that's not the one I will have to compress.
Before all, I want to serve the library files of Extjs (Ext-all.js, Ext-all.CSS) in precompressed form, since these are way bigger than my application file. They do not change very often, only when installing a new version of Extjs, so precompressing manually (not by Apache) is the obvious choice.
Again: that works ok on development server in Windows on my laptop, but production server is Suse Linux.
By the way: I will stick with Extjs 3 for a while, since version 4 is far too compicated too me.

- I did not try what would happen if the browser doesn't send Accep Encoding gzip. I suppose the server will send an uncompressed version then. But since I want to use a precompressed file in an intranet, I don't have to care about browsers that do not accept gzip encoding (I don't even know about one) , I can ask people to use one that does accept gzip.

Beste regards, Marc
marcvdm
 
Posts: 6
Joined: 21. January 2012 11:44
XAMPP Version: 1.8.3-3
Operating System: windows and linux

Re: gzip working fine on xampp Windows, but not on same Xamp

Postby JonB » 02. February 2012 15:01

- On Linux, the content is also serverd, but the header is missing, so Firefox does not decompress it and shows only bogus characters.


I think I understand what you are saying, is this right?

"on the Suse Linux server although the server tries to serve the page - the whole header is missing"... ???

It may have nothing to do with the encoding issue if the WHOLE header is missing, that may be an assumption.

IF ONLY the Encoding directive is missing its almost certainly an Apache or MIME issue.

My thought at the moment - look for a case mismatch in filenames between the code and the filenames on disk. Linux is completely case-sensitive, so a required file might be found on the Windows system due to case-insensitivity, but not found on Linux due to a 'case' issue - for instance My.CSS vs my.css... On Windows NTFS or CFS that is ONE file's name on Linux filessytems those are two different files.

Did you look in the Apache and any language-specific error logs on the Suse server???

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
XAMPP Version: 1.8.3-2
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: gzip working fine on xampp Windows, but not on same Xamp

Postby marcvdm » 04. February 2012 10:44

Hello JonB,

- The server does serve the file, it is actually arriving in the browser (this I can confirm in several ways). But the encoding: gzip directive is missing under Suse Linux, so the page is full of illegal characters.
- I checked case on all filenames, but they seem ok, they're all lowercase. By the way, the files on the Suse Linux are copies of the files on the Windows box.
- I thought I found some case errors in the .htaccess file (like Header Set instead, where it should be Header set), but this did not fix anything.
- Apache logs do not show any errors, nor does php logs. The only errors appear as javascript errors, which is to be expected since the encoding header is missing.
- I include my .htaccess here, maybe somebody spots another gotcha :

<Files *.js.gzip>
ForceType text/javascript
AddEncoding x-gzip .gzip
Header set Content-Encoding: gzip
</Files>

Also the mod_headers module is loaded correctly, as I'm told by phpinfo().

Beste regards, Marc
marcvdm
 
Posts: 6
Joined: 21. January 2012 11:44
XAMPP Version: 1.8.3-3
Operating System: windows and linux

Re: gzip working fine on xampp Windows, but not on same Xamp

Postby JonB » 04. February 2012 14:28

Hi Marc -

NO, I have NOT figured it out, but I will try an experiment this weekend.

For the benefit of all, I would like to help dispel a misconception (one you de-bunked by test) about Apache Directives. Although it is certainly a 'best practice' to code them in CamelCase, Apache Directives themselves are case-insensitive, although the arguments (parameters) are often case-sensitive.

Directives in the configuration files are case-insensitive, but arguments to directives are often case sensitive.


http://httpd.apache.org/docs/2.0/configuring.html

Thanks for including your .htaccess code.

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
XAMPP Version: 1.8.3-2
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: gzip working fine on xampp Windows, but not on same Xamp

Postby marcvdm » 04. February 2012 14:40

Aha, found it!

Actually, the https: is not configured the same way on both machines.
On the windows machine, all files reside in htdocs, but http is redirected to https.
On the Linux machine, everything is stored in /private_html instead of /htdocs.
My stupid error: that directory doesn't have a section with AllowOverride All and Options Indexes etc.. directives in httpd.conf., like htdocs has.
This means .htaccess is completely denied in that folder.

Adding a section with these directives for private_html in httpd.conf makes it work!
I wonder what to do on a server without access to httpd.conf though.

I hope that I did not introduce any security flaws by adding this, but I will check and leave out all that is not really necessary.

Thanks for your help anyway!

Beste regards, Marc
marcvdm
 
Posts: 6
Joined: 21. January 2012 11:44
XAMPP Version: 1.8.3-3
Operating System: windows and linux

Re: gzip working fine on xampp Windows, but not on same Xamp

Postby JonB » 04. February 2012 18:05

I'm glad you figured it out. Its always best that way... (although you may not feel like it when you are frustrated).

On most shared servers with Control Panels, there is normally a 'check' to configure your http and https the same. I think that would like address this issue.

I'm very glad you found it, as I have been detoured onto learning about Virtualmin for another Open Source project I work on. That has delayed a conversion and the test I was going to do on this issue -- so I am quite happy! When I get a chance I am goign to verify my suspicions on a managed VPS I control that has a Control Panel with one of those http/https options I just referred to.

Good Luck

8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
XAMPP Version: 1.8.3-2
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 4 guests