New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apache servers behind a load balancer on virtual IP cannot find input resources #117

Closed
GoogleCodeExporter opened this Issue Apr 6, 2015 · 12 comments

Comments

Projects
None yet
1 participant
@GoogleCodeExporter

GoogleCodeExporter commented Apr 6, 2015

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/calen
dar.css" type="text/css" media="screen"/>
<link rel="stylesheet" 
href="http://www.xxx.com/yyy/assets/js/yui/build/container/assets/skins/sam/cont
ainer.css" type="text/css" media="screen"/>
<link rel="stylesheet" 
href="http://www.xxx.com/yyy/assets/js/yui/build/datatable/assets/skins/sam/data
table.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/pagi
nator.css" type="text/css" media="screen"/>


Original issue reported on code.google.com by justin...@gmail.com on 26 Nov 2010 at 4:57

Attachments:

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

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.

Original comment by jmaes...@google.com on 27 Nov 2010 at 2:31

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

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 (http://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!

Original comment by justin...@gmail.com on 29 Nov 2010 at 5:56

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Im having the same issue. Using Codeigniter here was well. i was wondering what 
was going on :)

Original comment by mdgr...@goodsally.com on 29 Nov 2010 at 11:00

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

please let me know if you've found the solution, thanks! i will do the same.

Original comment by justin...@gmail.com on 29 Nov 2010 at 11:53

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

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.

Original comment by jmara...@google.com on 30 Nov 2010 at 12:06

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

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.

Original comment by justin...@gmail.com on 30 Nov 2010 at 4:27

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

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.

Original comment by jmara...@google.com on 30 Nov 2010 at 4:55

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

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.

Original comment by justin...@gmail.com on 1 Dec 2010 at 3:38

Attachments:

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

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?

Original comment by justin...@gmail.com on 1 Dec 2010 at 5:38

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

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


Original comment by jmara...@google.com on 1 Dec 2010 at 11:31

  • Changed title: Apache servers behind a load balancer on virtual IP cannot find input resources
@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Added a FAQ entry explaining the workaround.

Original comment by jmara...@google.com on 3 Dec 2010 at 10:19

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Original comment by jmara...@google.com on 3 Dec 2010 at 10:19

  • Changed state: Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment