referer

Attribute Macro referer 

Source
#[referer]
Expand description

Restricts function execution to requests with a specific referer.

This attribute macro ensures the decorated function only executes when the incoming request has a referer header that matches the specified value. Requests with different or missing referer headers will be filtered out.

ยงUsage

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

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

#[referer("https://api.localhost")]
async fn handle_api_referer(ctx: Context) {
    // Function body for requests from api.localhost
}

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