I’ve enabled my glitch website project (https://incandescent-cylinder.glitch.me/) with a custom domain (https://www.ericlimer.com/) but in doing so, I appear to have broken the functionality of the Glitch button that allows users to view the code and remix. On the original URL, the button works fine, but on the custom URL it points users to https://www.glitch.me, a project by an unrelated user, instead.
Is there a way to fix this, or is it just the price of enabling a custom domain?
Hi @ericlimer I think I see what you mean; i’m going to test it on one of my projects as well, but i’m wondering if you’d be willing to set up ericlimer.com (as opposed to www.ericlimer.com) on the same project. You may need to use an A record instead of a CNAME for that; our help docs on the subject can give you some guidance on the subject.
If you’re willing to set up that additional config please let me know what the results look like. I’ll report back with what I find in my own tests as well.
thanks @cori! interested to hear the results of your test. On my end it appears that when I set it up without the www the Glitch button just disappears entirely.
This is a result of the way the JavaScript for the Glitch button works; as written it won’t support projects on custom domains, which is why it doesn’t show up on ericlimer.com at all. On www.ericlimer.com the script mistakenly thinks your project is a completely different one, as you noted, but as it’s written there’s no way to get it to work transparently.
I’m going to bring this up to the team and we’ll see about rewriting the script to work better with custom domains.
Hey folks, the Glitch Button project has been updated to avoid this problem by preventing the button from displaying on custom domains similarly to how it won’t display on private projects.
To get it to work properly with custom domains we have some work to do on the back end, so that’s probably going to be a little while.
Thanks @cori and @ericlimer This thread, and the help doc was helpful for setting up my custom domain. Though as you explained, the Glitch Button project needs an enhancment to resolve the issue.
Is there an update on using the Glitch Button project for custom domains?
In my investigation I have cloned the button.js into my project as glitch-button.js. I have removed the location.hostname check, which I believe is the temporary solution you mention. With my change I experience the button with proper functionality. Perhaps the original issue has been resolved by your team, and if so only needs to remove the location.hostname check which currently disables the button?
We’ve got a little API work to do before we can fully support custom domains, but once we do and someone updates the button project we’ll definitely let everyone know here.