Secure cookies Pada Web Server Apache

Untuk menggunakan cookie HttpOnly dan Secure pada server Debian, Anda perlu mengonfigurasi web server Anda (misalnya, Apache) atau kerangka kerja aplikasi Anda untuk menetapkan atribut ini saat mengeluarkan cookie.

Jika Anda menggunakan Apache, Anda dapat mengaktifkan modul mod_headers lalu menambahkan arahan ke konfigurasi direktori atau host virtual Anda.

# a2enmod headers
# systemctl restart apache2

<VirtualHost *:443>
    # ... other configuration ...
    SSLEngine on
    # ... SSL certificate configuration ...

    # Add the Secure and HttpOnly flags to all Set-Cookie headers
    Header edit Set-Cookie ^(.*)$ "$1; Secure; HttpOnly"
</VirtualHost>
# systemctl restart apache2

Leave a Reply

Your email address will not be published. Required fields are marked *