开发者

How to use http parametrs in https page in rails using rails-ssl_requirement plugin

开发者 https://www.devze.com 2023-03-12 23:18 出处:网络
I want to fetch the parameters of the form submit from the http page to the action which is required SSL. Is it possible?

I want to fetch the parameters of the form submit from the http page to the action which is required SSL. Is it possible?

actually i have a form on page http://www.mydomain.com/logins/new but when i submit the form it redirected to the https://www.mydomain.com/logins/create开发者_StackOverflow社区 action but i don't get any parameters submitted from the new page form.

I solve this by requiring ssl for the new method and it works fine, but is it the only way to solve the problem or there is some other way to accomplish this so that i don't need to required on much of the actions.


If you're not using form helpers, just put the whole URL, including https, as the action for your form. If you are using form helpers, use the url (not path) and protocol option to specify https when you create your form. Like this:

<%= form_for @someobject, :url => the_create_url(:protocol => 'https') %>

You may have a slightly different set of options, but the main thing is specify :url with the url helper for your create action (ending in _url, not _path) and pass it the protocol option.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号