Pagination on tag page not fetching articles due to CORS issues [Headline Theme]

Issue Summary
On the tag page, a limited number of articles is displayed. Normally, Ghost would fetch additional articles at scrolling (request: https://www.example.com/example-tag/page/2/).
This is not working in my case and throws TypeError: Failed to fetch in Chrome or TypeError: NetworkError when attempting to fetch resource. in Firefox.

Site note: I have my main domain running without subdomain (https://kinu.earth/ not https://www.kinu.earth/) but it still tries to fetch https://www.kinu.earth/example-tag/page/2/ with subdomain. I assume this is somehow the source of the error and blocks CORS. See details on SSL and routing in Additional Information below.

Steps to Reproduce
See details on SSL and routing in Additional Information below.

  1. Add SSL certificate for subdomain
  2. Redirect nginx config with 301 to main domain for subdomain traffic (described below)
  3. Add enough articles to a tag, so that pagination is needed
  4. et voilá: fetching error

Setup information

Ghost Version
Ghost-CLI version: 1.24.0
Theme: Custom version of Headline (just added some sections to the home page, nothing else)

Node.js Version
v16.17.0

How did you install Ghost?
Followed the official guide for hosting on Digital Ocean

Provide details of your host & operating system
Hosted on a Digital Ocean droplet, using the Ghost Marketplace application

Browser & OS version
Firefox: Version 114.0.2
Chrome: Version 114.0.5735.198

Relevant log / error output
Chrome

  • Access to fetch at 'https://www.kinu.earth/nachhaltig-investieren/page/2/' from origin 'https://kinu.earth' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
  • GET https://www.kinu.earth/nachhaltig-investieren/page/2/ net::ERR_FAILED in pagination.js
  • Uncaught (in promise) TypeError: Failed to fetch

Additional Information

I have a SSL Certificate for the www subdomain. And reroute traffic from www. to my main domain. I tried to follow this official guide on the SSL configuration: Ghost-CLI - A fully loaded tool for installation and configuration

Therefore, I set the location in the nginx config to return 301:

location / {
        return 301 https://kinu.earth$request_uri;
    }

This might be the reason, however I have no idea how to fix it or further investigate. I would really appreciate help so that I can setup the SSL certificate for www. properly and avoid this fetching error.

:see_no_evil: Ok, I assume after updating the SSL and nginx settings I missed to restart ghost.

So

sudo nginx -s reload
ghost restart

did the trick. I was sure I did the sudo nginx -s reload but I probably missed the ghost restart (also that is not mentioned in the linked documentation. Maybe that helps someone

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.