My favorites | Sign in
Project Home Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 117: Apache servers behind a load balancer on virtual IP cannot find input resources
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Dec 2010


Sign in to add a comment
 
Reported by justin...@gmail.com, Nov 25, 2010
What steps will reproduce the problem?
1. Install and configure pagespeed.conf (as shown below)
2. Restart Apache
3. CSS and JS in CodeIgniter project are still remain in separate files

What is the expected output? What do you see instead?
Expected output: YUI library should combine with my css & js files.
Current output: All in separate files, no changes.

What version of the product are you using (please check X-Mod-Pagespeed
header)?
0.9.10.1-0

On what operating system?
CentOS 5.4

Which version of Apache?
Apache 2.2.14

Which MPM?
- ??

Please provide any additional information below, especially a URL or an
HTML file that exhibits the problem.

- Attached is my pagespeed.conf

- I set ModPagespeedDomain as "http://xxx.com" but i disable the cache under xxx.com subdomain, as seen under <Directory> in pagespeed.conf to test this module.  Is this necessary?

- I saw X-Mod-Pagespeed version under http://www.xxx.com in phpinfo() but it's not showing up if I print out the phpinfo() under http://www.xxx.com/yyy.

- I wrote the below lines in headers.php under views folder.  mod_pagespeed doesn't combine the css even if I specify combine_css in the config file:
<link rel="stylesheet" href="http://www.xxx.com/yyy/assets/css/style.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="http://www.xxx.com/yyy/assets/js/yui/build/button/assets/skins/sam/button.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="http://www.xxx.com/yyy/assets/js/yui/build/calendar/assets/skins/sam/calendar.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="http://www.xxx.com/yyy/assets/js/yui/build/container/assets/skins/sam/container.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="http://www.xxx.com/yyy/assets/js/yui/build/datatable/assets/skins/sam/datatable.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="http://www.xxx.com/yyy/assets/js/yui/build/menu/assets/skins/sam/menu.css" type="text/css" media="screen"/>
<link rel="stylesheet" href="http://www.xxx.com/yyy/assets/js/yui/build/paginator/assets/skins/sam/paginator.css" type="text/css" media="screen"/>


pagespeed.conf
6.0 KB   View   Download
Nov 27, 2010
Project Member #1 jmaes...@google.com
You're using the oldest release of mod_pagespeed, and a lot of bugs have been fixed in the last few weeks.  Could you try updating?  If the problem persists, it would be helpful to hear:
1) If you've been able to see the rewritten sample page
2) Whether you see other rewrites to your pages (such as cache extension)
3) Whether any mod_pagespeed entries appear in your logs.
Nov 28, 2010
#2 justin...@gmail.com
Hi, I've updated pagespeed to the current new release: 0.9.10.1-261
Now I can't do combine_css from the official sample even though I enabled the filter (using the same config as attached in this thread). I checked the FAQ section (https://code.google.com/p/modpagespeed/wiki/FAQ)before and found nothing.

Any idea how to check in order to get it working?  Appreciate your help.  Thank you!
Nov 29, 2010
#3 mdgr...@goodsally.com
Im having the same issue. Using Codeigniter here was well. i was wondering what was going on :)
Nov 29, 2010
#4 justin...@gmail.com
please let me know if you've found the solution, thanks! i will do the same.
Nov 29, 2010
Project Member #5 jmara...@google.com
FYI we have not implemented js combining yet, so it is not surprising that it didn't work for you.  We are planning to start the js combining implementation soon.

css combining should work.  I just scanned your original bug description and, unless I'm reading it wrong, you have mismatched your domain names.  You have conf file option:

  ModPagespeedDomain http://xxx.com

but your css files are all in http://www.xxx.com

Those are not equivalent (even if they DNS-map to the same IP address).  However, you can use wildcards or specify multiple ModPagespeedDomain directives so you can cover both xxx.com and www.xxx.com.

Nov 29, 2010
#6 justin...@gmail.com
thanks, i changed the links and the problem is still there. i'm not sure what's happening. i tried the other filters, some of them are not working: inline_css, inline_javascript, rewrite_images, extend_cache, rewrite_javascript.

does mod_pagespeed support load balancing servers?! if so, i've two identical pagespeed.conf hosted on both servers at the moment.
Nov 29, 2010
Project Member #7 jmara...@google.com
We designed mod_pagespeed to support load balancing servers, although that scenario is certainly less common, and therefore has less mileage.  This does not sound like a load-balancing servers issue.  This seems more like an issue of being able to fetch the content from your server and cache it in mod_pagespeed.

One possible scenario that would cause this symptom is the caching headers in your Apache configuration, as applied to the origin resources.  E.g. what do you see when you type:

wget --save_headers -O - http://www.xxx.com/yyy/assets/css/style.css | head 15

Does it say "Cache-control: private" or "Cache-control: nostore"?  Either of these directives would prevent mod_pagespeed from caching the css files, which is needed to rewrite them.

What do your error logs say?  Do they have anything interesting, especially anything that mentions the css files?  If not, could you set your loglevel to 'info', refresh your site in your browser, and then set it back?  mod_pagespeed will print a lot more information about the fetches it's trying to do.

Nov 30, 2010
#8 justin...@gmail.com
thanks for your guidance.  i've changed my .htaccess in order to cache files with js, css, jpg, gif, png file extensions.  as i don't have administrative rights and mod_headers.c is disabled,  i can only work with mod_expires.c (as seen from the attached .htaccess file).

on the other hand, i tested on the example files (combine_css.html) and found mod_pagespeed errors in the error log:
[Wed Dec 01 14:02:23 2010] [error] [mod_pagespeed 0.9.10.1-261] http://xxx.com/mod_pagespeed_example/combine_css.html:2: Failed to load resource http://xxx.com/mod_pagespeed_example/styles/yellow.css
[Wed Dec 01 14:02:23 2010] [error] [mod_pagespeed 0.9.10.1-261] http://xxx.com/mod_pagespeed_example/combine_css.html:3: Failed to load resource http://xxx.com/mod_pagespeed_example/styles/blue.css
[Wed Dec 01 14:02:23 2010] [error] [mod_pagespeed 0.9.10.1-261] http://xxx.com/mod_pagespeed_example/combine_css.html:4: Failed to load resource http://xxx.com/mod_pagespeed_example/styles/big.css
[Wed Dec 01 14:02:23 2010] [error] [mod_pagespeed 0.9.10.1-261] http://xxx.com/mod_pagespeed_example/combine_css.html:5: Failed to load resource http://xxx.com/mod_pagespeed_example/styles/bold.css
[Wed Dec 01 14:29:50 2010] [notice] child pid 13617 exit signal Segmentation fault (11)

But when i copy the resource links (e.g. http://xxx.com/mod_pagespeed_example/styles/bold.css) to the browser, the file does exist.  I changed the css links in combine_css.html to be absolute paths but the problem is still there.  any idea what's going on?  Thanks heaps & really appreciate your help.
.htaccess
561 bytes   View   Download
Nov 30, 2010
#9 justin...@gmail.com
ok, i've finally found out the problem. i'm not sure whether it's the apache settings or mod_pagespeed problem.  Here's the scenario:

===================
Setup
===================
Browser -> 10.0.0.80 (virtual IP) -> 10.1.0.80 (server A) -> central DB
                                  -> 10.1.0.81 (server B) /

10.0.0.80 will be doing the whole load-balancing thing.  mod_pagespeed is installed in both server A and B with the same config.

===================
Issues
===================
When browser requests file(s) from 10.0.0.80 (e.g. http://10.0.0.80/mod_pagespeed_example/styles/yellow.css mod_pagespeed cannot locate the file location and throws "Failed to load resource" exception.  

When I changed all the links pointing either to 10.1.0.80 or 10.1.0.81 (e.g. http://10.1.0.80/mod_pagespeed_example/styles/yellow.css it works perfectly as expected but it defeats the purpose of load balancing.


===================
Solution
===================
Is there anything i can do to deal with this problem?
Dec 1, 2010
Project Member #10 jmara...@google.com
Thanks for tracking this down!  The good news is that we have a solution to this problem: two new configuration directives:

ModPagespeedMapRewriteDomain rewrite_to_domain rewrite_from_domain   (you probably don't need this one yet)
ModPagespeedMapOriginDomain  origin_to_domain origin_from_domain

In your case you'll probably want

   ModPagespeedMapOriginDomain  localhost 10.0.0.80

or perhaps in server 10.1.0.80:

   ModPagespeedMapOriginDomain  10.1.0.80 10.0.0.80

and in server 10.1.0.81

   ModPagespeedMapOriginDomain  10.1.0.80 10.0.0.80

The bad news is that these directives are checked into SVN, but not available in a binary release yet, or in a source release branch.  To get them today you'll have to build mod_pagespeed from source, using the trunk rather than a branch.  But we are planning to cut a release this week so if you can be patient you'll have what I think is the right solution.


I'm changing the summary of your issue to match the actual symptom.

Summary was:  Cannot combine css or js in CodeIgniter project


Summary: Apache servers behind a load balancer on virtual IP cannot find input resources
Dec 3, 2010
Project Member #11 jmara...@google.com
Added a FAQ entry explaining the workaround.
Dec 3, 2010
Project Member #12 jmara...@google.com
(No comment was entered for this change.)
Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting