Ruby-on-Rails [SOLVED]: Blocking public access to my website with Coming-Soon page

Ruby-on-Rails [SOLVED]: Blocking public access to my website with Coming-Soon page

Home Forums Frameworks Ruby on Rails Tutorials Ruby-on-Rails [SOLVED]: Blocking public access to my website with Coming-Soon page

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #246772

    Cloudy Point
    Keymaster

    QuestionQuestion

    I have a Rails website and it is live under root url. I want to block public access to it. Preferably with a Coming Soon page. But I still want to access it “maybe with a login, or any other way” so that I can deploy my codes, continue adding content until I’m ready for public release.

    #246773

    Cloudy Point
    Keymaster

    Accepted AnswerAnswer

    Well, merry Xmas to you too.

    As for your question there are a lot of various solution here.
    You could do it directly through your HTTP Server, for exemple, tell you server to automaticaly redirect to /coming_soon if a defined HTTP HEADER is not found in the request.

    You could also set a custom cookie value in you browser with a randomized string and check the value in a before_filter
    (see How to access cookies from ApplicationController (Rails) )

    Or use an authorization gem like cancancan or pundit (I do prefer the latter over the former but it’s more a matter of taste) to define your redirection rules (I do think it would be overkill to use these gem only for that behavior though)

    Source: https://stackoverflow.com/questions/47972179/blocking-public-access-to-my-website-with-coming-soon-page
    Author: nekogami
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.