How to Place a TXT File in My Discourse Root Directory for WeChat Mini Program Verification?

Hello everyone,

I’m using the standard (official) Docker-based Discourse installation on my server at mydomain.com. I need to place a TXT file at https://mydomain.com/xx.txt so that it can be publicly accessible. This is required for verification to embed my Discourse site into a WeChat Mini Program via WebView. Specifically, WeChat Mini Program requires a TXT file at the domain’s root to confirm domain ownership.

Question: Where is the “root directory” for my Discourse site when installed via the default Docker setup?

Goal: To make https://mydomain.com/xx.txt accessible to the public.

Context: I need xx.txt to be served directly from the domain root. My forum is up and running, and I haven’t made any custom configuration changes apart from the standard ./discourse-setup procedure.

I’d greatly appreciate any guidance on how to achieve this.

Thank you for your help! I’m looking forward to any tips or best practices from the community. :smiling_face_with_three_hearts:

The easiest way is this Add files to root directory - #3 by fang

5 Likes

If it checks just for something in the file (rather than expecting the output to be exactly that file), you can add that text to a topic and then use a permalink redirect to make /xx.txt redirect to the topic.

8 Likes

… to the raw content, specifically, e.g.: https://meta.discourse.org/raw/345460/4

8 Likes

Right! I think that’s exactly what I told someone to do some years ago.

I periodically seem to forget that /raw/ path somehow.

So you just need to create a public topic with the text in it. You can unlist it so that it doesn’t show up in searches. As long as whatever is following the redirects, it should Just Work.

5 Likes

Your prompt and effective support has been invaluable to me, and I appreciate the time and effort you put into helping me find a solution.
Thank you once again!!!!!

4 Likes