【问题标题】:Can I protect with a .htaccess file some routes with sinatra?我可以用 .htaccess 文件保护一些带有 sinatra 的路由吗?
【发布时间】:2009-11-11 20:04:48
【问题描述】:

我用 Sinatra 编写了一个小应用程序,并有一些管理路由(/admin/new、admin/edit/2、...),并希望使用 .htaccess 提示符保护它们。谁能告诉我我是怎么做到的?

【问题讨论】:

    标签: ruby .htaccess sinatra


    【解决方案1】:
    AuthName "Restricted Area"
    AuthType Basic
    AuthUserFile /path/to/file/.htpasswd
    
    <Files "protected.html">
    Require valid-user
    </Files>
    

    如果您想使用 Sinatra 进行身份验证,请查看 this faq

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-01
      • 1970-01-01
      • 2015-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-31
      • 1970-01-01
      相关资源
      最近更新 更多