Forum: Ruby on Rails Implementing HTTPS with WEBrick?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2006-05-30 18:12
All,

I would like to test some secure pages that I'm developing in my
WEBrick-based development environment.

I've done some research and it appears that I need to create a new
command that will start a HTTPS based WEBrick server.  Is this correct?

Also, it appears that the https.rb module is not included with the
WEBrick bundled in Rails.  So, I will need to go get that piece, right?

Lastly, do I need to set up a cert. of my own on the server side to test
with?

Thanks,
Wes
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2006-05-30 18:54
Wes Gamble wrote:
> All,
>
> I would like to test some secure pages that I'm developing in my
> WEBrick-based development environment.
>
> I've done some research and it appears that I need to create a new
> command that will start a HTTPS based WEBrick server.  Is this correct?
>
> Also, it appears that the https.rb module is not included with the
> WEBrick bundled in Rails.  So, I will need to go get that piece, right?
>
> Lastly, do I need to set up a cert. of my own on the server side to test
> with?
>
> Thanks,
> Wes

I found this:

http://lists.rubyonrails.org/pipermail/rails/2006-...

and it appears to successfully start up a SSL Webrick for me.

I also found where all of the WEBrick stuff was stored in the standard
library for 1.8.4.

But I'd like to understand more about how that script works.

1) What does OpenSSL::SSL::VERIFY_NONE do?
2) I assume that the ::SSLCertName tells WEBrick to cause a SSL cert. to
be generated?  Is that correct?

Thanks,
Wes
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2006-05-30 19:16
Wes Gamble wrote:
> Wes Gamble wrote:
>> All,
>>
>> I would like to test some secure pages that I'm developing in my
>> WEBrick-based development environment.
>>
>> I've done some research and it appears that I need to create a new
>> command that will start a HTTPS based WEBrick server.  Is this correct?
>>
>> Also, it appears that the https.rb module is not included with the
>> WEBrick bundled in Rails.  So, I will need to go get that piece, right?
>>
>> Lastly, do I need to set up a cert. of my own on the server side to test
>> with?
>>
>> Thanks,
>> Wes
>
> I found this:
>
> http://lists.rubyonrails.org/pipermail/rails/2006-...
>
> and it appears to successfully start up a SSL Webrick for me.
>
> I also found where all of the WEBrick stuff was stored in the standard
> library for 1.8.4.
>
> But I'd like to understand more about how that script works.
>
> 1) What does OpenSSL::SSL::VERIFY_NONE do?
> 2) I assume that the ::SSLCertName tells WEBrick to cause a SSL cert. to
> be generated?  Is that correct?
>
> Thanks,
> Wes

I am successfully running my SSL server, however, I am unable to use
redirect_to to do my redirects to a different port?  How does one use
url_for to generate a URL for a specific port?

Thanks,
Wes
C1e5a9e9344b6d31b9df7303e6dc378a?d=identicon&s=25 Craig White (Guest)
on 2006-05-30 19:24
(Received via mailing list)
On Tue, 2006-05-30 at 19:16 +0200, Wes Gamble wrote:
> >> Also, it appears that the https.rb module is not included with the
> > http://lists.rubyonrails.org/pipermail/rails/2006-...
> > be generated?  Is that correct?
> >
> > Thanks,
> > Wes
>
> I am successfully running my SSL server, however, I am unable to use
> redirect_to to do my redirects to a different port?  How does one use
> url_for to generate a URL for a specific port?
----
generally, you would use url:port#
i.e.
https://www.domain.com:81

Craig
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2006-05-30 19:27
Craig White wrote:
> On Tue, 2006-05-30 at 19:16 +0200, Wes Gamble wrote:
>> >> Also, it appears that the https.rb module is not included with the
>> > http://lists.rubyonrails.org/pipermail/rails/2006-...
>> > be generated?  Is that correct?
>> >
>> > Thanks,
>> > Wes
>>
>> I am successfully running my SSL server, however, I am unable to use
>> redirect_to to do my redirects to a different port?  How does one use
>> url_for to generate a URL for a specific port?
> ----
> generally, you would use url:port#
> i.e.
> https://www.domain.com:81
>
> Craig

I'd like to do something like this:

redirect_to :protocol => 'https://', :action => 'login_form'

but be able to specify the port.

I tried using :host => request.host + ':3001' but it didn't work.

Do I specify additional params to url_for or do I just set up a route to
always build an https URL with a port of 3001?

Wes
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2006-05-30 19:34
Wes Gamble wrote:
> Craig White wrote:
>> On Tue, 2006-05-30 at 19:16 +0200, Wes Gamble wrote:
>>> >> Also, it appears that the https.rb module is not included with the
>>> > http://lists.rubyonrails.org/pipermail/rails/2006-...
>>> > be generated?  Is that correct?
>>> >
>>> > Thanks,
>>> > Wes
>>>
>>> I am successfully running my SSL server, however, I am unable to use
>>> redirect_to to do my redirects to a different port?  How does one use
>>> url_for to generate a URL for a specific port?
>> ----
>> generally, you would use url:port#
>> i.e.
>> https://www.domain.com:81
>>
>> Craig
>
> I'd like to do something like this:
>
> redirect_to :protocol => 'https://', :action => 'login_form'
>
> but be able to specify the port.
>
> I tried using :host => request.host + ':3001' but it didn't work.
>
> Do I specify additional params to url_for or do I just set up a route to
> always build an https URL with a port of 3001?
>
> Wes

A cursory reading of the URL rewriting code shows that if you want to
override the port, then you must do it as part of the host, using
something like

url_for :host => request.host + ':####' where #### is the name of the
new port.

Wes
This topic is locked and can not be replied to.