Static dir + file for Domain verification

I am setting up Stripe for my subscription plugin. It has an added feature for apple pay and Link payment methods. I need to setup a verification file at mydomain.com/.well-known/apple-developer-merchantid-domain-association

How do I serve a static file on a static folder in discourse? I have looked around at various options on the forums and can’t find a good solution for this use case.

1 Like

If you set up a Permalink pointing at the actual file (be it an upload, or posted somewhere else), does that pass verification?

It needs to be at the directory they provide: /.well-known/

In our experience with other validators, setting up a Permalink redirect from

/.well-known/apple-developer-merchantid-domain-association

to somewhere else where the necessary file is hosted has worked.

I suggest trying this first as it’s an easy solution.

2 Likes

Thank you Michael, I will try that and see if it passes verification.

It goes to the signup page. We were unable to verify ownership of yoursite.com. The request attempt at https://mysite.com/.well-known/apple-developer-merchantid-domain-association, redirected to https://mysite.com/login

My forum is open to new users, but they must register first.

You will need to make your site public in order for the domain verification to work, and then you can set it back to require login once that has been verified.

Hopefully it is a new site and there isn’t sensitive data yet. If there is content you do not want to temporarily make public you may have to lock down every single category to staff only while you are doing the domain verification. Sorry we don’t have an easier process for this at the moment.

… do you think special-casing Permalinks under /.well-known/ to work regardless of login-required might be a good idea?

This trick is a super simple way of getting this kind of verification working for site owners, and it would be great if we could make it work in all scenarios.

1 Like

Thank you both for the input. I made the site public, and put a permalink so that it goes to the file, but unfortunately it must be at this directory /.well-known/apple-developer-merchantid-domain-association.

I’m curious, can a custom folder / file structure be created on the discourse server somehow from outside? Such as a file being served from var/www/html/.well-known/