reject_referer

Attribute Macro reject_referer 

Source
#[reject_referer]
Expand description

Reject requests that have a specific referer header.

This attribute macro ensures the decorated function only executes when the incoming request does not have a referer header that matches the specified value. Requests with the matching referer header will be filtered out.

ยงUsage

use hyperlane::*;
use hyperlane_macros::*;

#[reject_referer("http://localhost")]
async fn handle_without_spam_referer(ctx: Context) {
    // Function body for requests not from localhost
}

The macro accepts a string literal specifying the referer value to filter out and should be applied to async functions that accept a Context parameter.