Conversation.js HTTP 404 since move to new domain/Cloudflare

I moved my M.B. on Sunday to a new custom domain and so far everything works and was moved to the new domain. (Except the ActivityPub thing).
Since the new domain is hosted from Cloudflare and I have enabled rules and things there, the only thing that is not working is the Conversations.js javascript. I get an HTTP 404 error in the browser and don’t know why?

When I try to copy&paste the URL in a browser it loads and says “post not found”.

Post is here: My #SundaySwing ideas week of 1/24 based on #TheStrat // Stratinator Microblog

Searching for help here :slight_smile:

Unfortunately, this will happen for all blog posts published before moving to the new custom domain.

conversation.js fetches the conversation going on over at the Micro.blog timeline for a specific blog post. In this case, the script is saying, "Hey, give me all replies for the blog post at https://www.stratinator.com/2022/01/23/my-sundayswing-ideas.html".

That URL was never sent to the Micro.blog timeline, and that’s the problem. At the time of posting, the URL was https://microblog.renem.net/2022/01/23/my-sundayswing-ideas.html. Hence the 404 Not Found error.

Unfortunately, conversation.js isn’t equipped to handle the domain move. @manton could probably implement support for it, though. Or, if you are comfortable with theme development, you could mitigate the problem yourself there.

2 Likes

Yep, that’s it. When you change your domain name, Micro.blog tries to go back to old URLs in posts and fix them, but it looks like it’s missing some. I think I can update your site to fix this. And long-term, agree with @sod that conversation.js could be improved to find even more posts if the URL doesn’t match.

1 Like

not sure but this might also relate to pre-domain change uploads: Is it possible to edit URLs of Uploads - #8 by warner
Any chance you could fix both on mine too please @manton ? Change was made June '21. Thanks!

2 Likes

@manton I have two posts from before my custom domain move that I’d also greatly appreciate being fixed if possible :sweat_smile:

Thank you!

1 Like

I stumbled upon this post while trying to understand the 404 error on my blog. I just changed the settings to a custom domain.

I found a workaround that might be useful to someone until a proper fix/update, if you’re comfortable with editing a custom theme. This change depends on your theme, specifically where the line <script type="text/javascript" src="https://micro.blog/conversation.js?url={{ .Permalink }}></script> is added. It should be in a theme file named layouts/post/single.html.

Once found, I changed it to

<script type="text/javascript" src="https://micro.blog/conversation.js?url={{ .Permalink | replaceRE "^https?://myname\\.mydomain\\.com/" "https://username.micro.blog/" }}"></script>

where myname.mydomain.com and username must be changed to your custom domain and username on Micro.blog, respectively.

1 Like