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

Wrong Hostname in relative path with mod_proxy #74

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

Comments

Projects
None yet
1 participant
@GoogleCodeExporter

GoogleCodeExporter commented Apr 6, 2015

What steps will reproduce the problem?
1. Configure mod_proxy with a different hostname
2. Display an html page withe an relative path

What is the expected output? What do you see instead?
Excpected: 
http://www.mysite.com/files/ce.d5ef78b5df0187a9947b79b4bd071b20.logo,p.png
Instead: http://xx.xx.xx.xx/files/ce.d5ef78b5df0187a9947b79b4bd071b20.logo,p.png

What version of the product are you using (please check X-Mod-Pagespeed
header)?
X-Mod-Pagespeed:0.9.0.0-0 / r181

On what operating system?
Debian

Which version of Apache?
Server version: Apache/2.2.9 (Debian)
Server built:   Apr 20 2010 15:42:00


Which MPM?

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

Absolute URL works fine.
I'm not sure, but I not remember this kind of error in older version.
Page speed use the host name defined in the mod_proxy configuration instead the 
the host name of the resquest.

You can find in attached files a simple way to reproduce this case.

Original issue reported on code.google.com by tanguy.c...@gmail.com on 12 Nov 2010 at 6:32

Attachments:

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Can you provide more information? Here's my guess, please correct:

1) mod_pagespeed is installed on www.mysite.com with this proxy.conf
2) You request http://www.mysite.com/index.html
3) The response comes back with a link to http://xx.xx.xx.xx/files/... instead 
of http://www.mysite.com/files/...

Original comment by sligocki@google.com on 12 Nov 2010 at 6:45

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Do you have mod_pagespeed installed on http://xx.xx.xx.xx/?

If so, when mysite.com makes the proxy sub-request, xx.xx.xx.xx may be 
rewriting with the (correct) absolute URL http://xx.xx.xx.xx/index.html . If 
that's the case, we could consider the feature of keeping URLs that were 
originally relative to stay relative.

Original comment by sligocki@google.com on 12 Nov 2010 at 6:48

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

1) mod_pagespeed is installed on www.mysite.com with this proxy.conf
2) You request http://www.mysite.com/index.html
3) The response comes back with a link to http://xx.xx.xx.xx/files/... instead 
of http://www.mysite.com/files/...

Excatly

Original comment by contact%...@gtempaccount.com on 12 Nov 2010 at 10:05

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Do you have mod_pagespeed installed on http://xx.xx.xx.xx/?

Original comment by sligocki@google.com on 12 Nov 2010 at 10:10

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

[deleted comment]
@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

No pagespeed is only installed on mysite.com

I made an other test, you can easily reproduce it.

I build a proxy configuration to apache.org web site form my server.
ProxyPass http://www.apache.org/

Without pagespeed we can see all images.
With pagespeed, all relative resources are broken.
The apache is 
http://www.apache.org/css/ce.4fd30b9be6c85a802e5fabc7ea3798a3.style,s.css
instead:
http://r33353.ovh.net/css/ce.4fd30b9be6c85a802e5fabc7ea3798a3.style,s.css

You can find the result here: http://r33353.ovh.net/

Regards

Original comment by tanguy.c...@gmail.com on 12 Nov 2010 at 10:16

Attachments:

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Great, thanks, I'll try to reproduce this myself.

Original comment by sligocki@google.com on 12 Nov 2010 at 10:20

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Reproduced. Thanks for the specific example.

Original comment by sligocki@google.com on 12 Nov 2010 at 10:36

  • Changed state: Accepted
@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

This may be solved if we resolve Issue 90

Original comment by jmara...@google.com on 17 Nov 2010 at 12:56

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Using the new parameters "ModPagespeedMapRewriteDomain" and 
"ModPagespeedMapOriginDomain" from the trunk solves this problem.

Original comment by tanguy.c...@gmail.com on 23 Nov 2010 at 10:22

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

You are industrious!  I'm glad this worked for you.

Yes, we have added this new functionality to our trunk.  If you build from 
trunk, please feel free to use the new configuration file directives and let us 
know how it goes.  It has not made it to a release branch or a binary yet, and 
the binary we are releasing today will not include it.  But the next binary 
release (after thanksgiving) will.

Original comment by jmara...@google.com on 23 Nov 2010 at 10:27

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

I add this configuration:
ModPagespeedMapRewriteDomain static.mysite.com xx.xx.xx.xx,www.mysite.com
ModPagespeedMapOriginDomain  www.mysite.com static.mysite.com

And now with this url (absolute or relative with mod_proxy):
http://www.mysite.com/files/logo.png
Is rewrite to:
http://static.mysite.com/files/ce.d5ef78b5df0187a9947b79b4bd071b20.logo,p.png
And not like this:
http://xx.xx.xx.xx/files/ce.d5ef78b5df0187a9947b79b4bd071b20.logo,p.png

This is better than I expected, I can use a cookieless domain.

You can close this issue.

Original comment by tanguy.c...@gmail.com on 24 Nov 2010 at 7:45

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Great, glad to hear that this works for you now!

I'd still like to keep this open so I can figure out what is going on with it, 
I'll demote it to Low Priority.

Original comment by sligocki@google.com on 25 Nov 2010 at 1:53

  • Added labels: Priority-Low
  • Removed labels: Priority-Medium
@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Shawn -- do you think we still need to leave this open?

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

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

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

  • Changed state: RequestClarification
@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

I'm guessing this is just how Apache behaves with ProxyPass. Closing.

Original comment by sligocki@google.com on 14 Jan 2011 at 6:26

  • Changed state: Fixed
  • Added labels: Priority-Medium
  • Removed labels: Priority-Low
@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

I had the same issue and ModPagespeedMapRewriteDomain was the solution. But 
only for the html code.

In the merged/minified CSS files all background image urls are replaced with 
the wrong url. An example:

ModPagespeedMapRewriteDomain mydomain.com 192.168.1.123:8080
Site URL: http://mydomain.com
Proxy URL: http://192.168.1.123:8080
Original CSS: background-image:(myimage.png);
Modified CSS: background-image:(http://192.168.1.123:8080/myimage.png);
Should be: background-image:(http://mydomain.com/myimage.png);

Do I need another configuration option for this, or this this another bug?

Original comment by alexande...@gmail.com on 9 Feb 2011 at 1:54

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Sounds like a new problem, created bug 212

Original comment by sligocki@google.com on 9 Feb 2011 at 4:30

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Aha, this was a bug. I believe it's fixed by r506.

Original comment by sligocki@google.com on 2 Mar 2011 at 10:01

@GoogleCodeExporter

This comment has been minimized.

GoogleCodeExporter commented Apr 6, 2015

Issue 221 has been merged into this issue.

Original comment by sligocki@google.com on 8 Mar 2011 at 3:22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment