为什么redirect_to _path提供HTTP而不是HTTPS网址
why does redirect_to _path provide a HTTP rather than HTTPS url?
在 Rails 3.0 应用程序中,我有一个控制器,其中包含许多像这样的方法,
class ReviewsController
# POST "/reviews/new_submit_form"
def new_submit_for
# some logic
redirect_to new_subject_reviews_url(:format => "js")
end
end
** terminal output **
Started POST "/reviews/new_submit_form" for 127.0.0.1 at 2012-07-06 11:40:00 -0400
Processing by ReviewsController#new_submit_form as
Parameters: {"question_sheet_id"=>"23"}
Existing local CAS session detected for "MYNAME@GMAIL.COM". Previous ticket "XX-1111-CjtSMaVpmiqBPsBoufke-plidma41" will be re-used.
Redirected to http://website.org/reviews/new_subject.js
Completed 302 Found in 1ms
问题是redirect_to new_subject_reviews_url(:format => "js")
返回HTTP网址而不是HTTPS网址。
我找到了一个解决方案, redirect_to new_subject_reviews_url(:format => "js", :protoco => "https://")
,但这需要我通过 Rails 应用程序编辑该方法。如何在我的 Rails 应用程序中全局解决此问题,而无需主要入侵 Rails?
我没有
找出原因,但我找到了解决方案。
Ccc360::Application.configure do
# all the other configs
# so that redirect_to will have, "https://www.mywebsite.org/xxxxxx"
config.action_controller.default_url_options = { :protocol => "https" }
end
相关文章:
- 反应路由器弄乱了请求网址
- 关于引入外部javascript文件的问题&css通过https
- jquery ajax https调用给出ERR_INSECURE_RESPONSE
- 如何在谷歌网站中使用javascript获取当前页面的网址
- 如何通过安全的https连接在javascript中使用基于soap xml的Web服务
- $https请求的安全性
- https.request ignoring rejectUnauthorized
- 使用谷歌搜索网址
- Express.js:在用户发帖时获取用户的引荐来源网址
- web配置http到https重定向异常
- HTML:从http到https发布表单
- Node.js https获取请求ECONNRESET
- CasperJS(phantom 1.9.7),从昨天起就无法连接https
- JQuery手机.网站上只有一个https页面
- 为什么redirect_to _path提供HTTP而不是HTTPS网址
- 离开页面时将网址从HTTPS更改为HTTP javascript
- 在 HTTPS 网站中包含不安全的流网址
- 在 HTTP 网站中使用 HTTPS 网址
- 检查用户提供的网址是否会重定向到 https 或 http
- 将 HTTPS 上的 HTTP 引荐来源网址设置为 HTTPS 站点