Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I get reverse a misstep--turning on https on localhost with force_ssl = true in Ruby on Rails
    primarykey
    data
    text
    <p>I can't seem to reverse a problem I created on my development machine. Luckily that was in a VM with some saved snapshots so I was able to go back to an earlier snapshot and reproduce the problem exactly in its simplest form. And, by going back to an earlier snapshot and just not repeating the misstep, I've worked around the issue, but the fact that I can't undo the change directly either suggests there is some bug, or I don't understand something critical which I'd like to. </p> <p>So here's the scenario:</p> <p>1) My Rails App works fine. I am on apache, a fully up to date Ubuntu 11.04 with postgresql for the db. Three things (a,b,c) that may be relevant:</p> <p>a) It has this GEM file:</p> <pre><code>source 'https://rubygems.org' gem 'rails', '3.2.6' gem 'bootstrap-sass', '2.0.0' gem 'pg', '0.12.2' gem 'bcrypt-ruby', '3.0.1' gem 'jquery-rails', '2.0.0' group :development, :test do gem 'rspec-rails', '2.10.0' gem 'guard-rspec', '0.5.5' end gem 'annotate', '~&gt; 2.4.1.beta', group: :development group :test do gem 'rspec-rails', '2.10.0' gem 'capybara', '1.1.2' gem 'rb-inotify', '0.8.8' gem 'libnotify', '0.5.9' gem 'guard-spork', '0.3.2' gem 'spork', '0.9.0' gem 'factory_girl_rails', '1.4.0' end # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '3.2.4' gem 'coffee-rails', '3.2.2' gem 'uglifier', '1.2.3' end </code></pre> <p>b) It has this file in /etc/apache2/sites-available/sample_app (FYI, yes I am working through the tutorial on <a href="http://ruby.railstutorial.org/ruby-on-rails-tutorial-book" rel="nofollow">http://ruby.railstutorial.org/ruby-on-rails-tutorial-book</a> though with apache and postgresql)</p> <pre><code>&lt;VirtualHost *:80&gt; ServerName localhost ServerAlias localhost RailsEnv development DocumentRoot /home/USER/railsProjects/sample_app/public &lt;/VirtualHost&gt; </code></pre> <p>and this virtual host is the only site enabled.</p> <p>c) it has this line uncommented in my rails project </p> <pre><code> config.force_ssl = true </code></pre> <p>NOTE: I haven't done anything special to configure apache to use SSL.</p> <p>2) In the /etc/apache2/sites-available/sample_app file, change the line from:</p> <pre><code>RailsEnv development </code></pre> <p>to:</p> <pre><code>RailsEnv production </code></pre> <p>save, then restart apache from the commandd line with:</p> <pre><code>sudo service apache2 restart </code></pre> <p>then go to localhost in the browser. In my case it doesn't work. That's fine--fixing that isn't my question. My question is, how do I reverse this change.</p> <p>3) The obvious answer would be to try this: Go back to /etc/apache2/sites-available/sample_app file and change line from: </p> <pre><code>RailsEnv production </code></pre> <p>back to:</p> <pre><code>RailsEnv development </code></pre> <p>save and then restart apache again.</p> <p>Unfortunately, that doesn't work. It seems at this point my system is left in what seems to be an unfixable state. Every time I go to </p> <pre><code>http://localhost </code></pre> <p>I am forwarded to </p> <pre><code>https://localhost </code></pre> <p>I have reproduced this behaviour several times and I cannot find any change between any of the files in /etc/ or in my railsproject between a working system where I never made the change, and a non-working system where I changed the environment to production and then changed it back.</p> <p>I'm hoping someone who really understands this stuff can help a newbie out on this one. Where do I go to remove the setting that is causing http: to forward to https?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload