A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
a11::net::CorsOptions Struct Reference

Cross-origin policy for an A11 HTTP surface. More...

#include <cpp/a11/net/server_headers.h>

Public Member Functions

absl::Status Validate () const
 

Public Attributes

bool enabled = true
 Whether cross-origin headers are sent at all.
 
std::string allow_origin = "*"
 Access-Control-Allow-Origin. * admits any page.
 
std::string allow_methods = "GET, POST, OPTIONS"
 Access-Control-Allow-Methods. Every method A11's routes use.
 
std::string allow_headers = "content-type, accept, authorization, x-a11-*"
 Access-Control-Allow-Headers.
 
std::string expose_headers = "x-a11-stream-id, x-a11-outbound"
 Access-Control-Expose-Headers: what a page may read off the response.
 
int max_age_seconds = 600
 Access-Control-Max-Age in seconds; 0 omits it.
 

Detailed Description

Cross-origin policy for an A11 HTTP surface.

The default admits any browser origin. Set allow_origin to narrow it or clear enabled to omit CORS headers. CORS governs browser access; server reachability is controlled by the listener configuration.

Member Function Documentation

◆ Validate()

absl::Status a11::net::CorsOptions::Validate ( ) const
Returns
OK if no value would inject a header break.

Member Data Documentation

◆ allow_headers

std::string a11::net::CorsOptions::allow_headers = "content-type, accept, authorization, x-a11-*"

Access-Control-Allow-Headers.

A11's own header prefix plus the ones a JSON or SSE request carries.

◆ allow_methods

std::string a11::net::CorsOptions::allow_methods = "GET, POST, OPTIONS"

Access-Control-Allow-Methods. Every method A11's routes use.

◆ allow_origin

std::string a11::net::CorsOptions::allow_origin = "*"

Access-Control-Allow-Origin. * admits any page.

◆ enabled

bool a11::net::CorsOptions::enabled = true

Whether cross-origin headers are sent at all.

◆ expose_headers

std::string a11::net::CorsOptions::expose_headers = "x-a11-stream-id, x-a11-outbound"

Access-Control-Expose-Headers: what a page may read off the response.

Exposes the stream ID and outbound modes required by browser SSE clients.

◆ max_age_seconds

int a11::net::CorsOptions::max_age_seconds = 600

Access-Control-Max-Age in seconds; 0 omits it.


The documentation for this struct was generated from the following files: