Wednesday, May 15, 2024

Caddy webserver to prevent access from external machines on the network

How to protect your local caddy installation by preventing other machines outside of your localhost and local computer from accessing your device.


Create rule:

(block_outcoming) {

       @denied not client_ip 127.0.0.1 ::1
        handle @denied {
                respond "No access"
        }
}

 

Then inside your website configuration just add

import  block_outcoming

 

E.g.:

:80 {

    import block_outcoming

    root * /web/html

}


No comments:

Post a Comment

GeekCon 2025 - Building an Arcade Machine (rhythm machine)

GeekCon is by far the best conference I have ever participated in. If you are not that familiar about GeekCon , so shortly, once every year...