-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
Description
In SSL-terminating load-balanced environments, bwp-google-xml-sitemaps fails with the following error:
BWP Google XML Sitemaps Error: sitemapindex.xml does not have any item. Please make sure that you have at least one sitemap enabled in BWP Sitemaps >> XML Sitemaps >> Sitemaps to generate.
This is because of a discrepancy in URL scheme:
- Initial sitemap request comes in on HTTPS.
- Load-balancer terminates SSL and forwards request to content server over HTTP.
- WP_HOME is set to HTTPS.
- BWP detects difference in scheme and fails --
BWP_Sitemaps_Sitemap_Provider::is_url_valid()returns false.
I suggest removing the lines following // url must use the current scheme in bwp-google-xml-sitemaps/src/sitemap/provider/provider.php (or reverting d3b58be) to remove this restriction.
Alternate solutions:
- Somehow make use of WordPress'
set_url_scheme()to normalize URLs before comparing. We register a filter for this action in order to get WordPress to support our situation. - Add a hook to allow overriding.
- Make the check optional depending on configuration.
- Add a check to see if
$_SERVER['HTTP_X_FORWARDED_PROTO']is "https" when determining$is_ssl.