decap-cms: Netlify CMS doesn't work when hosting on Netlify with access restriction
BUG REPORT INFORMATION
Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST –>
- Do you want to request a feature or report a bug? Bug
- What is the current behavior? while hosting on netlify, i have set a password restriction in netlify for visitors while the website is being developed. when i try to access the admin view, the page is empty. if i remove the password from netlify, the cms starts working again.
- If the current behavior is a bug, please provide the steps to reproduce.
- follow quick setup guide for netlify cms
- in netlify hosting, set password in Access Control section
- go to mysite.netlify.com/admin
- now the ‘login with netlify identity’ pops up
- click on login button
- a dark grey overlay gets added, but nothing else shows up, errors in browser console:
netlify-identity-widget.js:1 GET http://mysite.netlify.com/.netlify/identity/settings 500 (Internal Server Error)
- What is the expected behavior? at step 6, i expect to see the login widget
- Please mention your CMS, node.js, and operating system version. Netlify CMS version 0.7.3 node v7.5.0 macOS sierra 10.12.6
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 24 (14 by maintainers)
@tech4him1 You’re right—looks like the reported issue with password-protected sites has been fixed in the 4 months since I wrote up that workaround. Must have been on the password-protection side of things, since I haven’t updated the CMS on my test site.
Thank you @verythorough for the workaround!
For Gatsby, since I am using the
gatsby-plugin-netlify-cmsplugin I had to leave theBuild commandsetting togatsby build, and I set thePublish directorytopublic/adminCheers!
There’s actually another workaround for this issue - you can run Netlify CMS on a separate site.
To demonstrate, I deployed a site using the Netlify CMS Jekyll starter.
Before adding password protection, I visited the site and added a post in the CMS. I could see the post in the main site as well as in the CMS Collection list.Then I turned on password protection, and confirmed that the post could no longer be found in the CMS UI.
You can try it yourself at https://hidden-site.netlify.com/admin The site password is
I'm hidingRegistrations are open, and I’ve enabled GitHub login, so you can log in quickly. You’ll see that there are no posts in the collection list.Next, I made a separate site, from the same repo, at https://open-cms.netlify.com This time, I removed the build command and set the publish directory to
admin. I did not turn on password protection, but did enable Identity and Git Gateway for login to the CMS. The only part of the repo that is published to this site is the CMS.You can access it at https://open-cms.netlify.com, again using open registration with GitHub. You’ll see there are posts in the collection list, and when you add or edit a post, and it will build on the main site.
I used the Jekyll starter because the CMS setup in
/adminis standalone, which made it easy to demo. You could include build tools, though, and you could separate the CMS from the main site in a variety of ways.With a custom domain setup, you could have the main content site at sitename.com and the admin UI at a subdomain like admin.sitename.com.