#[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("https://example.com")]
async fn handle_example_referer(ctx: Context) {
// Function body for requests from example.com
}
#[referer("https://api.example.com")]
async fn handle_api_referer(ctx: Context) {
// Function body for requests from api.example.com
}
The macro accepts a string literal specifying the expected referer value and should be
applied to async functions that accept a Context
parameter.