Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

332
Views
How to encrypt full routes in ruby on rails at Application level

I want to encrypt routes in ruby on rails application through routes file.

Sample URL: http://localhost:3000/users or http://localhost:3000/users/1/edit

Encrypted URL: http://localhost:3000/dshfkhjkbkbjkdfjkfdhk or http://localhost:3000/dshfkhjkbkbjkdfjkfdhk/dskjfs/hdfkjdf

It's possible to encrypt using any gem. How to manage all routes encryption at the Application level

Thank you in Advance

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can't. All you can do is implement your own router, and map all encrypted paths to a single controller and let that controller call your router.

# config/routes.rb
match '*path', to: 'encrypted#index', via: :all
class EncryptedController < ApplicationController
  def index
    path = params[:path]
    decrypted_path = path.split('/').map{|part| decrypt(part)}.join('/')
    MyRouter.dispatch(request.method, decrypted_path, request)
  end
end
module MyRouter
  def self.dispatch(request_method, path, request)
    # Your own dispatching logic here.
    # Note that this method should return a Rack-compatible response.
  end
end
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!