Skip to content
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

Load-balanced environments not supported #47

Open
vshih opened this issue Apr 29, 2017 · 0 comments
Open

Load-balanced environments not supported #47

vshih opened this issue Apr 29, 2017 · 0 comments
Assignees

Comments

@vshih
Copy link

vshih commented Apr 29, 2017

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.
@kminh kminh self-assigned this Nov 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants