我正在使用Jekyll建立我的个人网站,并将其托管在github-pages上。我想有一个密码保护的区域(只是密码保护的目录,而不是整个网站)。我尝试了一些方法和技巧来让htaccess正常工作,但都失败了。
我想知道是否有人设法使用htaccess或任何其他方法来保护github-pages上的目录。
列出对我不起作用的解决方案(或者我没能让它们起作用):
*Jeremy Ricketts.
发布于 2017-10-02 16:57:58
GitHubPages (像Bitbucket pages和GitLab Pages)只提供静态页面,所以唯一的解决方案是客户端(Javascript)。
一个解决方案可以是,而不是使用真正的身份验证,只需与所有授权人员共享一个秘密(密码),并实现以下方案之一:
请参见示例:https://github.com/matteobrusa/Password-protection-for-static-pages
优点:保护整个子目录树的非常简单的方法
缺点:
- possible attack: sniffing the following requests to obtain the name of the subdirectory
- the admins on the hosting site have access to the full contents
请参见示例:https://github.com/robinmoisson/staticrypt
优点:没有纯文本页面代码(解密发生在客户端)
缺点:
- just a single page, and need to reinsert the password on every refresh
- an admin could change your Javascript code to obtain the password when you insert it
发布于 2018-09-10 23:14:58
一种选择是使用Cloudflare访问来控制DNS级别的访问。使用Cloudflare for DNS为您的Git页面设置自定义域后,您可以使用其访问规则策略要求在指定的url路径上进行身份验证。
如果有人熟悉绕过DNS阻止,则仍然可以绕过此漏洞。
发布于 2014-11-22 00:26:31
你可以试试Jekyll Auth,如果你遇到麻烦,你可以试试this issue can be useful。
https://stackoverflow.com/questions/27065192
复制相似问题