DEV Community

Sharon
Sharon

Posted on

Protect Your Web Application with SafeLine: A Step-by-Step Guide

This guide walks you through how to configure and protect a web application using SafeLine WAF.


Prerequisite

Make sure SafeLine is already installed and running.

If not, check out the installation guide first.


How SafeLine Works

SafeLine is a web application firewall (WAF) built on Nginx.

It works as an HTTP/HTTPS reverse proxy, sitting in front of your app to inspect and filter incoming traffic.

All traffic goes through SafeLine first. It blocks malicious requests and only forwards clean traffic to your backend.

How it works


Proxy an Application with SafeLine

  1. Log in to the SafeLine Admin Console.
  2. Go to Applications → Applications.
  3. Click Add Application.
  4. Fill in your app details:

Add application

  • Domain: Your app’s domain name or IP (e.g. www.chaitin.com)
  • Port: The port SafeLine should listen on (e.g. 80 or 443) For HTTPS, check the SSL option.
  • Upstream: The actual address (IP or domain) of your backend app

Once saved, update your DNS to point your domain to the SafeLine server's IP.

Now you can access your app through the domain — fully protected by SafeLine.

Running app


Simulate Web Attacks

To verify that SafeLine is working, try simulating some common attacks.

If your app is protected by SafeLine, test it with URLs like these (replace with your own domain):

  • SQL Injection

    https://yourdomain.com/?id=1+and+1=2+union+select+1

  • XSS

    https://yourdomain.com/?id=<img+src=x+onerror=alert()>

  • Path Traversal

    https://yourdomain.com/?id=../../../../etc/passwd

  • Code Injection

    https://yourdomain.com/?id=phpinfo();system('id')

  • XXE

    https://yourdomain.com/?id=<?xml+version="1.0"?><!DOCTYPE+foo+SYSTEM+"">

If the attack is detected, SafeLine will block it and show an interception page:

Blocked page


View Attack Logs in the Console

  1. Go to the Logs tab in the Admin Console.
  2. You’ll see a list of blocked or detected attacks:

Logs

  1. Click Detail to view full info about any attack:

Log details


Join Our Community

Need help? Reach out anytime:

Top comments (0)