0

I'm using the excellent Rack Rewrite gem in one of my Rails projects.

I used it to rewrite http requests to https://whatever.tld. Here's the snippet from config/application.rb:

   config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do
      r301 %r{.*}, 'https://whatever.tld$&', :scheme => 'http'
    end

...which works nicely.

However, now every time I boot up ANY rails app in dev, it kicks me off to https://whatever.tld

Does anyone know how to tell the middleware not to use that rule any more?

Thanks in advance!

TerryS
  • 7,169
  • 1
  • 17
  • 13

1 Answers1

3

I assume you're accessing the other projects via the same URL (like http://localhost:3000)?

You're using a 301 permanent redirect here, which means the browser won't even check with the server before redirecting for subsequent visits. So if http://localhost:3000/ returns a 301, it doesn't matter what server is running, it won't be accessed.

Use a different URL that is unique to your redirect app, or a temporary redirect. Or clear out your browser cache between switching projects.

Daniel Westendorf
  • 3,375
  • 18
  • 23