studioespresso / craft-seo-fields

Fields for your meta & OG data, sitemaps & robots.txt. Set default meta description & image per site and customize them per entry.
https://plugins.craftcms.com/seo-fields
Other
2 stars 4 forks source link

sitemap.xml return 503 when not loggedin #11

Closed jlachancekffein closed 5 years ago

jlachancekffein commented 5 years ago

I use the plugin to generate a sitemap for a site.

Everything works correctly when the user is connected to the control panel.

However, if the user is not connected (example a robot), the url returns a 503 - Service unavailable error.

The url used is http://example.com/sitemap.xml

Is there a configuration to put in place to make functional?

Thanks for your help !

Informations: Craft version : Craft CMS 3.2.9 Plugin version : 1.0.0

Capture d’écran 2019-08-13 à 11 26 53

janhenckens commented 5 years ago

Hey there,

I can't reproduce the issue for an anonymous request on any of my test sites. Are you running any other plugins on the site?

jlachancekffein commented 5 years ago

Hi,

Here the composer require list :

"craftcms/cms": "^3.0.0",
"vlucas/phpdotenv": "^2.4.0",
"nesbot/carbon": "^1.38",
"firebase/php-jwt": "^5.0",
"guzzlehttp/guzzle": "^6.3",
"drewm/mailchimp-api": "^2.5",
"craftcms/redactor": "^2.0.1",
"spicyweb/craft-neo": "^2.3.5",
"spicyweb/craft-fieldlabels": "^1.1.1",
"chasegiunta/craft-jason": "^1.0.2",
"verbb/field-manager": "^2.1.0",
"craftcms/mailgun": "^1.4.2",
"ostark/craft-async-queue": "^2.0",
"lukeyouell/craft-hideadmin": "^1.0",
"doublesecretagency/craft-cpbodyclasses": "^2.1.0",
"mmikkel/incognito-field": "^1.1.1.1",
"verbb/expanded-singles": "^1.0.7",
"nystudio107/craft-imageoptimize": "^1.5.5",
"studioespresso/craft-seo-fields": "^1.0",
"supercool/tablemaker": "^2.0",
"kffein/craft-koddein-fields": "^1.3"
janhenckens commented 5 years ago

Thanks for the extra info.

Could you try uninstalling the plugin and then try to access that url again? Does it still throw the 503?

jlachancekffein commented 5 years ago

Hi,

Good idea. But now it return 404 error. That make sense.

Here the complete error stack

image

janhenckens commented 5 years ago

Check. Could you try changing your sitemap settings? Maybe try just enabling 1 section (a homepage single or something like that) and see it still crashes?

jlachancekffein commented 5 years ago

Still crash !

jlachancekffein commented 5 years ago

It's really weird because in SeoFields.php

if ($shouldRender) {
                    $event->rules = array_merge($event->rules, [
                        'sitemap.xml' => 'seo-fields/sitemap/render',
                        'sitemap_<siteId:\d>_<type:(entry|product|category)>_<sectionId:\d>_<handle:.*>.xml' => 'seo-fields/sitemap/detail'
                    ]);
                }

The $shouldRender condition is met and the rules is add to the listed rules...

For an unknown reason, if i'm not connected to CP, the rules do not apply....

janhenckens commented 5 years ago

I reinstalled the plugin on my test install and now I'm having the same issue. Diving in :) I'll try to get back to you asap!

jlachancekffein commented 5 years ago

Not a good news but at least it will be easier for you to find a solution. :)

Thank you for the follow up.

janhenckens commented 5 years ago

Just published an update that should address this. Could you give it a try and let me know if it works now? Thanks!

jlachancekffein commented 5 years ago

Thank you so much.

Now it work without problems.

janhenckens commented 5 years ago

Great! Let me know if you run into anything else, happy to help out :)