Struct worker::CfProperties

source ·
pub struct CfProperties {
    pub apps: Option<bool>,
    pub cache_everything: Option<bool>,
    pub cache_key: Option<String>,
    pub cache_ttl: Option<u32>,
    pub cache_ttl_by_status: Option<HashMap<String, i32>>,
    pub minify: Option<MinifyConfig>,
    pub mirage: Option<bool>,
    pub polish: Option<PolishConfig>,
    pub resolve_override: Option<String>,
    pub scrape_shield: Option<bool>,
}
Expand description

Fields§

§apps: Option<bool>

Whether Cloudflare Apps should be enabled for this request. Defaults to true.

§cache_everything: Option<bool>

This option forces Cloudflare to cache the response for this request, regardless of what headers are seen on the response. This is equivalent to setting the page rule “Cache Level” (to “Cache Everything”). Defaults to false.

§cache_key: Option<String>

A request’s cache key is what determines if two requests are “the same” for caching purposes. If a request has the same cache key as some previous request, then we can serve the same cached response for both.

§cache_ttl: Option<u32>

This option forces Cloudflare to cache the response for this request, regardless of what headers are seen on the response. This is equivalent to setting two page rules: “Edge Cache TTL” and “Cache Level” (to “Cache Everything”). The value must be zero or a positive number. A value of 0 indicates that the cache asset expires immediately.

§cache_ttl_by_status: Option<HashMap<String, i32>>

This option is a version of the cacheTtl feature which chooses a TTL based on the response’s status code. If the response to this request has a status code that matches, Cloudflare will cache for the instructed time, and override cache directives sent by the origin. For example: { “200-299”: 86400, 404: 1, “500-599”: 0 }. The value can be any integer, including zero and negative integers. A value of 0 indicates that the cache asset expires immediately. Any negative value instructs Cloudflare not to cache at all.

§minify: Option<MinifyConfig>

Enables or disables AutoMinify for various file types. For example: { javascript: true, css: true, html: false }.

§mirage: Option<bool>

Whether Mirage should be enabled for this request, if otherwise configured for this zone. Defaults to true.

§polish: Option<PolishConfig>

Sets Polish mode. The possible values are lossy, lossless or off.

§resolve_override: Option<String>

Directs the request to an alternate origin server by overriding the DNS lookup. The value of resolve_override specifies an alternate hostname which will be used when determining the origin IP address, instead of using the hostname specified in the URL. The Host header of the request will still match what is in the URL. Thus, resolve_override allows a request
to be sent to a different server than the URL / Host header specifies. However, resolve_override will only take effect if both the URL host and the host specified by resolve_override are within your zone. If either specifies a host from a different zone / domain, then the option will be ignored for security reasons. If you need to direct a request to a host outside your zone (while keeping the Host header pointing within your zone), first create a CNAME record within your zone pointing to the outside host, and then set resolve_override to point at the CNAME record.

Note that, for security reasons, it is not possible to set the Host header to specify a host outside of your zone unless the request is actually being sent to that host.

§scrape_shield: Option<bool>

Whether ScrapeShield should be enabled for this request, if otherwise configured for this zone. Defaults to true.

Implementations§

source§

impl CfProperties

source

pub fn new() -> Self

Trait Implementations§

source§

impl Default for CfProperties

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<&CfProperties> for JsValue

source§

fn from(props: &CfProperties) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V