在Heroku上使用Golang应用程序进行.htaccess基本身份验证。

huangapple go评论91阅读模式
英文:

Golang app on Heroku htaccess basic auth

问题

在Heroku上运行的Golang应用程序中使用htaccess是可能的吗?我已经阅读了这个链接,但是解决方案对我不起作用(而且,在Heroku的bash中无法识别htpasswd命令,但我使用了这个工具生成了htpasswd文件)。

谢谢。

英文:

Is possible use htaccess on golang application running in heroku??
I had read this link but the solution doesn't work for me (also, the command htpasswd is not recognized in the heroku bash, but I made the htpasswd file usin this tool).

Thank you.

答案1

得分: 2

一个Go Web应用程序是一个服务器,所以不需要使用Apache httpd服务器,特别是在Heroku上,它有清晰的Go部署指南:

https://devcenter.heroku.com/categories/go

按照这些指南进行操作,你会发现不需要Apache。

htaccess和htpasswd与Apache httpd服务器相关,它们是Apache的配置文件。

最后,Go标准库提供了实现基本身份验证所需的所有工具:

https://golang.org/pkg/net/http/#Request.BasicAuth

英文:

A Go web application is a server so no need to use Apache httpd server, especially on Heroku that has crystal clear deployment instructions for Go :

https://devcenter.heroku.com/categories/go

Follow these instruction closely and you'll find out there is no need for Apache.

htaccess and htpasswd are related to Apache httpd server, they are Apache configuration files.

Finally, Go standard library gives you all the tools you need to implement basic auth yourself :

https://golang.org/pkg/net/http/#Request.BasicAuth

huangapple
  • 本文由 发表于 2016年11月25日 23:25:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/40808154.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定