# Ssl\_requirement, posts change to get and parameters are lost

**URL:** <https://www.ruby-forum.com/t/ssl-requirement-posts-change-to-get-and-parameters-are-lost/128033>\
**Category:** Rails\
**Created:** [February 4, 2008, 12:44pm UTC](https://www.ruby-forum.com/t/ssl-requirement-posts-change-to-get-and-parameters-are-lost/128033 "2008-02-04T12:44:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bartb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bartb](https://www.ruby-forum.com/u/bartb)\
**Post date:** [February 4, 2008, 12:44pm UTC](https://www.ruby-forum.com/t/ssl-requirement-posts-change-to-get-and-parameters-are-lost/128033/1 "2008-02-04T12:44:57Z")

</div>

Hi,

I hope this isn’t a stupid question but I’ve searched all over and can’t  
find any one else having the same issue.

I have just tried to add ssl to my app using ssl\_requirement. I have  
hit a snag when my product page attempts to submit to my add to cart  
action.

From the logs as far as I can tell what is happening is that the initial  
submit of the form has the correct parameters, then it gets caught by  
ssl\_requirement and redirected to https but at this point it appears to  
have changed from a post request to a get request and my parameters with  
product id and quantity are no longer in the request.

Is this something that is known or am I just doing something wrong:  
I’ll append a snippit from the log so you can see the issue.

Thanks for any help

Bart

Processing StoreController#view\_product (for 1.2.3.4 at 2008-02-04  
22:08:55) [GET]  
Session ID: cf83cbfcc7f51c2023aab3d2dc5de576  
Parameters: {“action”=\>“view\_product”, “id”=\>“7”,  
“controller”=\>“store”}  
Rendering within layouts/store  
Rendering store/view\_product  
Completed in 0.11419 (8 reqs/sec) | Rendering: 0.04087 (35%) | DB:  
0.00911 (7%) | 200 OK [[http://new.website.com/store/view\_product/7](http://new.website.com/store/view_product/7)]

Processing StoreController#shopping\_cart (for 1.2.3.4 at 2008-02-04  
22:08:58) [POST]  
Session ID: cf83cbfcc7f51c2023aab3d2dc5de576  
Parameters: {“commit”=\>“Add to Cart”, “quantity”=\>“1”,  
“action”=\>“shopping\_cart”, “id”=\>“7”, “controller”=\>“store”}  
Redirected to [https://new.website.com/store/shopping\_cart](https://new.website.com/store/shopping_cart)  
Filter chain halted as  
[#\<ActionController::Filters::ClassMethods::SymbolFilter:0xb7075708  
@filter=:ensure\_proper\_protocol\>] returned\_false.  
Completed in 0.00041 (2416 reqs/sec) | DB: 0.00000 (0%) | 302 Found  
[[http://new.website.com/store/shopping\_cart](http://new.website.com/store/shopping_cart)]

Processing StoreController#shopping\_cart (for 1.2.3.4 at 2008-02-04  
22:08:58) [GET]  
Session ID: cf83cbfcc7f51c2023aab3d2dc5de576  
Parameters: {“action”=\>“shopping\_cart”, “controller”=\>“store”}  
log we think the cart is empty 0 redirecting to prev page  
Redirected to [http://new.website.com/store/view\_product/7](http://new.website.com/store/view_product/7)  
Completed in 0.13120 (7 reqs/sec) | DB: 0.00750 (5%) | 302 Found  
[[https://new.website.com/store/shopping\_cart](https://new.website.com/store/shopping_cart)]

Processing StoreController#view\_product (for 1.2.3.4 at 2008-02-04  
22:08:59) [GET]  
Session ID: cf83cbfcc7f51c2023aab3d2dc5de576  
Parameters: {“action”=\>“view\_product”, “id”=\>“7”,  
“controller”=\>“store”}  
Rendering within layouts/store  
Rendering store/view\_product  
Completed in 0.09578 (10 reqs/sec) | Rendering: 0.03834 (40%) | DB:  
0.00856 (8%) | 200 OK [[http://new.website.com/store/view\_product/7](http://new.website.com/store/view_product/7)]

---

<div class="post-metadata">

**Author:** ![bartb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bartb](https://www.ruby-forum.com/u/bartb)\
**Post date:** [February 4, 2008, 3:00pm UTC](https://www.ruby-forum.com/t/ssl-requirement-posts-change-to-get-and-parameters-are-lost/128033/2 "2008-02-04T15:00:10Z")

</div>

Bart,

Just reading your log comments and the third includes this, “log we  
think the cart is empty 0 redirecting to prev page.” Is that a  
symptom or cause of the problem?

On Feb 4, 6:44 am, Bart B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![bartb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bartb](https://www.ruby-forum.com/u/bartb)\
**Post date:** [February 4, 2008, 9:32pm UTC](https://www.ruby-forum.com/t/ssl-requirement-posts-change-to-get-and-parameters-are-lost/128033/3 "2008-02-04T21:32:07Z")

</div>

AndyV wrote:

> Bart,
> 
> Just reading your log comments and the third includes this, “log we  
> think the cart is empty 0 redirecting to prev page.” Is that a  
> symptom or cause of the problem?
> 
> On Feb 4, 6:44 am, Bart B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

This is a simptom. What happens is that at the top of the function I  
check if we are passed the id of a product to add or if the cart is  
empty.

As the parameter id to add the product to the cart isn’t passed through  
the https redirect for some reason and this is the first item we are  
adding to the cart it redirects back to where you came from.

I could change it to show an empty cart I guess but that still wouldn’t  
solve the problem of losing the parameters.  
Bart

---

<div class="post-metadata">

**Author:** ![bartb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bartb](https://www.ruby-forum.com/u/bartb)\
**Post date:** [April 25, 2008, 6:27pm UTC](https://www.ruby-forum.com/t/ssl-requirement-posts-change-to-get-and-parameters-are-lost/128033/4 "2008-04-25T18:27:23Z")

</div>

We are running into a similar issue on a project…have been trying to  
work around it for the past couple days.

We see:  
Filter chain halted as  
[#\<ActionController::Filters::ClassMethods::SymbolFilter:0xb7575474  
@filter=:ensure\_proper\_protocol\>] rendered\_or\_redirected.

But then the page does not render!

Anyone have any suggestions as to how to resolve this?

We are using the following plugins:  
acts\_as\_state\_machine  
acts\_as\_tree  
calendar\_date\_select  
restful\_authentication  
ssl\_requirement

We’re on RHE4 linux using:  
Apache 2.2.6  
Rails 2.02  
Ruby 1.8.6

---

<div class="post-metadata">

**Author:** ![bartb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bartb](https://www.ruby-forum.com/u/bartb)\
**Post date:** [May 15, 2008, 5:35pm UTC](https://www.ruby-forum.com/t/ssl-requirement-posts-change-to-get-and-parameters-are-lost/128033/5 "2008-05-15T17:35:13Z")

</div>

kozmic wrote:

> On Apr 25, 6:27ï¿½pm, David C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > We see:  
> > Filter chain halted as  
> > [#\<ActionController::Filters::ClassMethods::SymbolFilter:0xb7575474  
> > @filter=:ensure\_proper\_protocol\>] rendered\_or\_redirected.
> 
> We have the same log entries.
> 
> Our workaround was to add ssl\_required to all controllers and their  
> actions, missing one will give you this error (atleast for us).

Hrm, even this doesn’t seem to work for me… Anyone else have thoughts?  
This did work before when I tested out ssl\_requirement earlier in my  
app’s development. Has something changed?

class ApplicationController \< ActionController::Base

include AuthenticatedSystem  
include SslRequirement

before\_filter :require\_ssl

helper :all

def require\_ssl  
redirect\_to :protocol =\> “https://”  
end

def ssl\_required?  
true  
end

end

Filter chain halted as [:ensure\_proper\_protocol] rendered\_or\_redirected.

---

<div class="post-metadata">

**Author:** ![bartb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/848f3c/32.png) [@bartb](https://www.ruby-forum.com/u/bartb)\
**Post date:** [May 1, 2008, 2:15pm UTC](https://www.ruby-forum.com/t/ssl-requirement-posts-change-to-get-and-parameters-are-lost/128033/6 "2008-05-01T14:15:31Z")

</div>

On Apr 25, 6:27 pm, David C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> We see:  
> Filter chain halted as  
> [#\<ActionController::Filters::ClassMethods::SymbolFilter:0xb7575474  
> @filter=:ensure\_proper\_protocol\>] rendered\_or\_redirected.

We have the same log entries.

Our workaround was to add ssl\_required to all controllers and their  
actions, missing one will give you this error (atleast for us).
