Lifanna

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Enable HTTPS SSL in rails localhost

Good day, i tried to enable https secure connection for my rails application.
First of all, set config.force_ssl = true in application.rb only. So, re-started rails server, but there was error: "HTTP parse error, malformed request (): #<Puma::HttpParserError: Invalid HTTP format, parsing fails."
Also, i created SSL certificate with command: "openssl req -x509 -sha256 -nodes -newkey rsa:2048 -days 365 -keyout localhost.key -out localhost.crt" then put it in server directory.
Then started my server with command: rails s -b 'ssl://localhost:3000?key=path/to/file/localhost.key&cert=path/to/file/localhost.crt'
But i had new error
How should i solve this problem?( Are there any solutions of enabling https?
logo Created with Sketch.

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2022 GoRails, LLC. All rights reserved.