Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

conflict with mod_speling #194

Closed
GoogleCodeExporter opened this issue Apr 6, 2015 · 16 comments
Closed

conflict with mod_speling #194

GoogleCodeExporter opened this issue Apr 6, 2015 · 16 comments

Comments

@GoogleCodeExporter
Copy link

This report is copied from the discussion list.  Mails will be pasted as 
comments.

Original issue reported on code.google.com by jmara...@google.com on 24 Jan 2011 at 6:13

@GoogleCodeExporter
Copy link
Author

I've been using mod_pagespeed on a dedicated server, and it's been
working like a champ; very slick.  Thanks for the module.

With the directives now valid in .htaccess, I'm attempting to making
mod_pagespeed available on a clustered shared hosing system.  I want
the module off by default for compatibility, but allow for those
people wanting to juice their sites by turning it on via .htaccess.
However, I am having problems with image, css, and javascript rewrites
not being found.  I've seen other using mod_pagespeed in clustered
environments, but haven't seen anyone using it in a vhosts-alias
setup, so I am suspicious that might be the problem, even though I
have no evidence.

You can see the behavior at http://test.exavatar.com/

* X-Mod-Pagespeed       0.9.14.6-358 shows in the response headers
* I can see filters working, such as the small css file becoming
inline, and html whitespace being minified.
* The image file appears in /var/mod_pagespeed/cache/, but, the
rewritten image is not found by the browser

Anyone have any ideas on what is the problem, or what I should
investiage?  I'm happy to do any legwork to narrow down the problem.

Pagespeed Server config:
<IfModule pagespeed_module>
   ModPagespeed off
   AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
   ModPagespeedFileCachePath            "/var/mod_pagespeed/cache/"
   ModPagespeedGeneratedFilePrefix      "/var/mod_pagespeed/files/"
    ModPagespeedFileCacheSizeKb          10240000
    ModPagespeedLRUCacheByteLimit        163840
   <Location /mod_pagespeed_statistics>
       Order allow,deny
       Allow from localhost
       SetHandler mod_pagespeed_statistics
   </Location>
</IfModule>

.htaccess:
ModPagespeed On
ModPagespeedRewriteLevel CoreFilters
ModPagespeedEnableFilters
collapse_whitespace,rewrite_javascript,rewrite_css


Pagespeed logs:
Jan 16 19:28:39 web8 apache2[21360]: [info] [mod_pagespeed

Original comment by jmara...@google.com on 24 Jan 2011 at 6:15

@GoogleCodeExporter
Copy link
Author

From me:

Hi -- thanks for the note.  I tried looking at your test server in firebug.  
I've never seen the particular response-code before that I'm seeing on your 
site.  For all rewritten resources, your site is returning response with status 
code 300 (multiple responses) in place of the desired response. 

Here are some theories:

1. That could be an interaction with some other module loaded into Apache, that 
is intercepting our response prior to it being served.  What other modules are 
enabled?
2. This could be a multi-server setup behind a load balancer, and not every 
server has mod_pagespeed enabled.  (This is my least favorite theory right now 
because the error page served with the 300 has itself been rewritten with 
mod_pagespeed and tagged with an output header X-Mod-Pagespeed saying so).
3. There is some proxy-server in the path which is not expecting URLs of the 
form mod_pagespeed generates.  I was wondering where this header comes from:
    MW-webserver: web10
I have not seen that one before either.

Do any of these sound plausible to you?

There is a Wiki entry on using mod_pagespeed with VirtualHost: 
http://code.google.com/p/modpagespeed/wiki/VirtualHostExamples
- Show quoted text -

Original comment by jmara...@google.com on 24 Jan 2011 at 6:16

@GoogleCodeExporter
Copy link
Author

From Tom:

Hi, thanks for the input.

1) Seems plausible. The status code 300 is from mod_speling; it is
detecting that the rewritten url is close to the original, and
suggesting that as an alternative.  You can see that in action by
going to the rewritten URL directly.  Trust me, I'd love to turn off
mod_speling, but customers love it for some reason! :)

Here are all the modules we have enabled:

web4:/etc/apache2/mods-enabled# ls *.load
actions.load     auth_digest.load  authz_default.load
authz_user.load  deflate.load  expires.load  info.load        mod-
security.load  rewrite.load   speling.load  suexec.load
alias.load       auth_mysql.load   authz_groupfile.load
autoindex.load   dir.load      headers.load  mime.load
negotiation.load   sbox.load      ssl.load      unique_id.load
auth_basic.load  authn_file.load   authz_host.load
cgi.load         env.load      include.load  mime_magic.load
pagespeed.load     setenvif.load  status.load   vhost_alias.load

The sbox module is the only non-standard module, it is a cgi handler,
so shouldn't come into play for those images, css and javascript.  See
any other suspicious ones?

On 2) I am confident all the servers in the cluster have pagespeed
running and configured the same.

3) Isn't plausible, we don't have proxy servers.  The MW-webserver
header is something we set with mod_env, so that we know which server
a response is from, in case of problems on a single server.

Does pagespeed only write files in /var/mod_pagespeed/...?  We're
running with suexec, so all of the content directories are not owned
by www-data, so that could be a problem if pagespeed is actually
trying to write anything in the content directories.

Thanks in advance,

Tom

Original comment by jmara...@google.com on 24 Jan 2011 at 6:16

@GoogleCodeExporter
Copy link
Author

From me:

mod_pagespeed only writes files in the two directories specified in the 
configuration file.

It's possible this is a file permissions problem, but I would've expected to 
see something to that effect in the logs.  Does each user run with their own 
file permissions from the same server?  Or does each user have their own 
VirtualHost?

The file directories configuration settings are per-virtual host and cannot be 
changed in htaccess.

Original comment by jmara...@google.com on 24 Jan 2011 at 6:16

@GoogleCodeExporter
Copy link
Author

From Tom:


Each user's CGIs run as their user, but html, images, javascript, etc,
are just accessed by the webserver users.  The pagespeed cache and
files are being written as the webserver user.

Each user does not have their on VirtualHost, because we are using
vhost_alias, like this:

VirtualDocumentRoot /domains/%-2.1/%-2.0.%-1/htdocs/%-3+

I understand that ModPagespeedGeneratedFilePrefix and
ModPagespeedFileCachePath cannot be set in .htaccess, that is why they
are in /etc/apache2/mods-enabled/pagespeed.conf, the "Server config" I
pasted above.

Original comment by jmara...@google.com on 24 Jan 2011 at 6:17

@GoogleCodeExporter
Copy link
Author

I think module-interaction is my first guess, but I haven't been able to get 
deep into your complete list of enabled modules yet.  I'm not sure what all 
those modules do.  Could you give a run-down of the modules you are using 
beyond the core set that are typically enabled?

Original comment by jmara...@google.com on 24 Jan 2011 at 6:36

@GoogleCodeExporter
Copy link
Author

Ok, sounds good.  I can systematically disable modules to see if any of them 
are in the way.

Original comment by exava...@gmail.com on 25 Jan 2011 at 4:46

@GoogleCodeExporter
Copy link
Author

Sorry for the delay on checking the modules.  My results are funny, considering 
we talked about mod_speling already.  Mod_speling is the conflict with 
mod_pagespeed!  When disabled, I'm not seeing the problems I reported earlier.  
Also, turning the spell-checking off with

http://httpd.apache.org/docs/current/mod/mod_speling.html#checkspelling

takes care of the problem.  I'm satisfied with just documenting the conflict, 
if you are; since mod_speling's hook is defined at the end of the end of the 
request cycle like this:

    ap_hook_fixups(check_speling,NULL,NULL,APR_HOOK_LAST);

, it seems to me like there's pretty much no getting around it.


Original comment by exava...@gmail.com on 1 Feb 2011 at 9:18

@GoogleCodeExporter
Copy link
Author

OK that's great.  Thanks, Tom.  Now we can take a look more deeply at what 
check_speling() is doing and try to make mod_pagespeed resilient to it.

Original comment by jmara...@google.com on 1 Feb 2011 at 10:02

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Summary was: site using htaccess and virtualhosts failing to fetch resources

Original comment by sligocki@google.com on 24 Feb 2011 at 10:45

  • Changed title: conflict with mod_speling

@GoogleCodeExporter
Copy link
Author

I've repro'd this problem.  Looking to see if we can defeat mod_speling for 
mod_pagespeed resources.

Original comment by jmara...@google.com on 7 Mar 2011 at 2:23

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

This is fixed as of r520.

Note that we are in the process of issuing a new release and this will *not* be 
included.  We'd like to let this fix bake for a while.

Original comment by jmara...@google.com on 8 Mar 2011 at 12:07

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Original comment by sligocki@google.com on 15 Mar 2011 at 10:09

  • Added labels: release-note

@GoogleCodeExporter
Copy link
Author

The fix for this made it into binary release 0.9.16.9, which went live 
yesterday, March 16.

Original comment by jmara...@google.com on 17 Mar 2011 at 12:30

@GoogleCodeExporter
Copy link
Author

Original comment by sligocki@google.com on 21 Mar 2011 at 5:39

  • Removed labels: release-note

@GoogleCodeExporter
Copy link
Author

Original comment by matterb...@google.com on 20 Aug 2012 at 5:31

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant