![](/img/trans.png)
[英]Login with Facebook with authlogic and omniauth-facebook
[英]Omniauth-facebook login not working
以HTTPS模式運行本地服務器可能很多次,不僅僅適用於facebook api。
雖然,Rails仍然沒有提供在SSL模式下運行rails服務器的簡單方法 。 但有幾種方法可以實現這一目標:
使用thin
服務器而不是puma / webrick rails默認值
thin
服務器允許您以最少的工作量以SSL模式運行應用程序:
編輯config/application.rb
並添加:
config.force_ssl = true
啟動thin
服務器:
$ thin start --ssl
請參閱此處的完整信息: 如何在兩分鍾內為Rails開發環境啟用SSL?
使用像ngrok
這樣的http隧道工具
像ngrok這樣的工具允許您輕松地創建從本地主機到Internet的隧道 - 它還為您創建http://
和https://
端點:
$ rails s -p 3000
$ ./ngrok http 3000
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Session Expires 7 hours, 59 minutes
Version 2.2.8
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://2608e936.ngrok.io -> localhost:3000
Forwarding https://2608e936.ngrok.io -> localhost:3000
復制生成的URL(如https://2608e936.ngrok.io
並使用它來訪問本地服務器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.