0

Rust – Secure Actix-web Application with TLS

This post demonstrates how to secure a Actix-web web application in Rust.

Requirements

These are items used for this post.

New Cargo Project

Create a new project in Ubuntu using the following command.

Create two .pem files

Please these two files to place them in the new actix-web-ssl directory

cert.pem

key.pem

Update Cargo.toml

Main Function

Demo and Test

For testing the web application, we use Mozilla FireFox because it allows for accessing a URL with self-signed SSL certificate.

Build and Start Web Application

First, build the application using cargo build  command. Then, run it using cargo run  command.

Access URL

Type in https://localhost:8088/countries  on the browser and press Enter to proceed.

 

Karl San Gabriel

Karl San Gabriel

Professional Software Developer