How CSRF Tokens work in Ruby on Rails?

Category: Ruby :: Published at: 16.12.2024

All modern frameworks offer protection against CSRF attacks, so these attacks are not as common anymore.
However, this does not mean we don't need to understand what they are and how to protect ourselves from them.

In this article, I will explain what a Rails engineer needs to know about CSRF.

Read more

How to reinstall MySQL on MacOS ARM M1 (and not only)

Category: Ruby :: Published at: 09.12.2024

If you have any issue with MySQL and you want to completely reinstall it on your machine.

This is a quick guide, how to do it:

Read more

How to easily connect your docker container with a postgres on EC2 instance

Category: Ruby :: Published at: 11.10.2024

Let's say, you have a Rails app packed inside docker container. You also have a pg server installed directly on your virtual machine (well, just to save your money). This can be a problem, because on production you should allow only specific ips to have a connection to your database.

How you can do it then? This is a tutorial.

Read more

How to renew SSL certificates with Certbot

Category: Ruby :: Published at: 29.09.2024

If you are using Amazon Linux 2 and want to install SSL Certificate for your domains, certbot is a right call.

This is how you can do it, and also additional info about how you can renew existing certificate

Read more

Problem with NGINX - Unprocessable entity localhost

Category: Better programmer :: Published at: 09.06.2024

When you try to run application, for example on Amazon Linux server, and trying to connect it
with a domain with the use of NGINX you can encounter some problematic issue.

You're starting server but, and it works, but when you try to make POST request, you're getting 422 Unprocessable Entity error.

This is because your application is still sending localhost Header, an this is not recognized by the app.

To fix this you need to modify your NGINX configuration

Read more

How to create SystemCTL Service on Amazon EC2 to run application on start

Category: Better programmer :: Published at: 06.05.2024

There are two simple ways to run application on Amazon EC2.

One is to run screen command and run application there as a process.

Second one, probably better, is to create SystemCTL Service which you can run later.

This is how to do it:

Read more