在rails 4路由中强制使用https的正确方法是什么?
例如,我希望能够做这样的事情:
get 'success' => 'ssl#success', :ssl_only => true
但这没什么用。
发布于 2013-09-22 21:53:29
发布于 2013-09-22 21:16:07
如果你想要https://.../ssl/success
scope constraints: { protocol: 'https' } do
get 'success', to: 'ssl#success', as: 'success'
end
或
get 'success', to: 'ssl#success', as: 'success', constraints: { protocol: 'https' }
发布于 2013-09-22 22:49:02
我最终得到了这份工作:
get 'success', to: 'ssl#success', constraints: {protocol: /https/}
https://stackoverflow.com/questions/18952115
复制相似问题