I have two domains mydomain.com and alias.mydomain.com. alias.mydomain.com is nothing, but a CNAME to mydomain.com. All public requests will be served through, mydomain.com.
How do I configure this properly so that the optimized files won't be cached separately?
Currently I am using the following configuration
ModPagespeedDomain www.mydomain.com
ModPagespeedDomain www.alias.mydomain.com
ModPagespeedLoadFromFile "http://www.mydomain.com/" "/var/www/vhosts/username/public_html/"
ModPagespeedLoadFromFile "http://alias.mydomain.com/" "/var/www/vhosts/username/public_html/"
But this is not working as expected. It works correctly for most of the files, but for some file it gives a 404 error. For example, a file www.mydomain.com/entertainment/I._,Mco.Gkw7JDe1yd.css.pagespeed.cf.oN5k-hjpgQ.css is giving a 404 error, when accessed as alias.mydomain.com/entertainment/I._,Mco.Gkw7JDe1yd.css.pagespeed.cf.oN5k-hjpgQ.css
Yes, I have outline_css and outline_javascript filters enabled. Fortunately, there is only one Apache server.
I am not sure if ModPagespeedMapRewriteDomain will help me here. As mentioned in one of the other discussions, I am using EdgeCast as an origin pull CDN for my static resources. It is very difficult to prevent origin pull CDN from serving HTML content, and this causes duplicate content issue. I was using a long list of mod_rewrite rules to block EdgeCast IP addresses from accessing HTML files. It is difficult to keep the IP addresses up to date.I am now trying a different configuration, where alias.mydomain.com (which is a ServerAlias of mydomain.com) is set as the CDN origin at EdgeCast. Now I can detect all requests from the CDN by checking the HTTP_HOST variable. alias.mydomain.com will be used only by the CDN, and it will not appear in HTML code served to users.When a user visit a page, the outlined CSS get rewritten asWhen the browser requests the CDN for the file, it will contact the origin for the fileSo, I want mod_pagespeed to rewrite requests for alias.mydomain.com/* to mydomain.com/*. Should I use ModPagespeedMapRewriteDomain or ModPagespeedMapOriginDomain for this?Thanks,Joyce
Sorry for the confusion. I was actually referring to mapping requests for alias.mydomain.com to mydomain.com. Mod_pagespeed rewrites www.mydomain.com/request-file-path to cdn.mydomain.com/request-file-path (due to ModPagespeedShardDomain directive). cdn.mydomain.com is an origin pull CDN. It will pull the file from the origin ( alias.mydomain.com/request-file-path ). Currently, mod_pagespeed does not know that www.mydomain.com, cdn.mydomain.com and alias.mydomain.com are all serving the same content. Hence, it will create duplicate copies of the optimized resource under/var/www/mod_pagespeed/cache/http,3A/,2Falias.mydomain.com/var/www/mod_pagespeed/cache/http,3A/,2Fcdn.mydomain.comIs it possible to inform mod_pagespeed that alias.mydomain.com and cdn.mydomain.com are same, hence it should map requests for resources under alias.mydomain.com to cdn.mydomain.com? It should use the existing cached file under /var/www/mod_pagespeed/cache/http,3A/,2Fcdn.mydomain.com rather than creating a new file at /var/www/mod_pagespeed/cache/http,3A/,2Falias.mydomain.com.
According to https://developers.google.com/speed/docs/mod_pagespeed/https_support , I cannot use ModPagespeedMapOriginDomain along with ModPagespeedLoadFromFile. So, if I use the following configurationModPagespeedDomain www.mydomain.com
ModPagespeedDomain alias.mydomain.com
ModPagespeedMapOriginDomain http://www.mydomain.com http://alias.mydomain.com
ModPagespeedLoadFromFile "http://www.mydomain.com/" "/var/www/vhosts/username/public_html/"ModPagespeedLoadFromFile "http://alias.mydomain.com/" "/var/www/vhosts/username/public_html/"
Should I remove the ModPagespeedLoadFromFile directive? If so, will mod_pagespeed automatically map the domain alias.mydomain.com to the file system path /var/www/vhosts/username/public_html/, or will it make HTTP requests for fetching the files?