PageRule
Provides a Cloudflare page rule resource.
Example Usage
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
class MyStack : Stack
{
public MyStack()
{
// Add a page rule to the domain
var foobar = new Cloudflare.PageRule("foobar", new Cloudflare.PageRuleArgs
{
ZoneId = @var.Cloudflare_zone_id,
Target = $"sub.{@var.Cloudflare_zone}/page",
Priority = 1,
Actions = new Cloudflare.Inputs.PageRuleActionsArgs
{
Ssl = "flexible",
EmailObfuscation = "on",
Minify =
{
{
{ "html", "off" },
{ "css", "on" },
{ "js", "on" },
},
},
},
});
}
}
Coming soon!
import pulumi
import pulumi_cloudflare as cloudflare
# Add a page rule to the domain
foobar = cloudflare.PageRule("foobar",
zone_id=var["cloudflare_zone_id"],
target=f"sub.{var['cloudflare_zone']}/page",
priority=1,
actions={
"ssl": "flexible",
"emailObfuscation": "on",
"minify": [{
"html": "off",
"css": "on",
"js": "on",
}],
})import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
// Add a page rule to the domain
const foobar = new cloudflare.PageRule("foobar", {
zoneId: _var.cloudflare_zone_id,
target: `sub.${_var.cloudflare_zone}/page`,
priority: 1,
actions: {
ssl: "flexible",
emailObfuscation: "on",
minify: [{
html: "off",
css: "on",
js: "on",
}],
},
});Create a PageRule Resource
new PageRule(name: string, args: PageRuleArgs, opts?: CustomResourceOptions);def PageRule(resource_name, opts=None, actions=None, priority=None, status=None, target=None, zone_id=None, __props__=None);func NewPageRule(ctx *Context, name string, args PageRuleArgs, opts ...ResourceOption) (*PageRule, error)public PageRule(string name, PageRuleArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args PageRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args PageRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PageRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
PageRule Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The PageRule resource accepts the following input properties:
- Actions
Page
Rule Actions Args The actions taken by the page rule, options given below.
- Target string
The URL pattern to target with the page rule.
- Zone
Id string The DNS zone ID to which the page rule should be added.
- Priority int
The priority of the page rule among others for this target, the higher the number the higher the priority as per API documentation.
- Status string
Whether the page rule is active or disabled.
- Actions
Page
Rule Actions The actions taken by the page rule, options given below.
- Target string
The URL pattern to target with the page rule.
- Zone
Id string The DNS zone ID to which the page rule should be added.
- Priority int
The priority of the page rule among others for this target, the higher the number the higher the priority as per API documentation.
- Status string
Whether the page rule is active or disabled.
- actions
Page
Rule Actions The actions taken by the page rule, options given below.
- target string
The URL pattern to target with the page rule.
- zone
Id string The DNS zone ID to which the page rule should be added.
- priority number
The priority of the page rule among others for this target, the higher the number the higher the priority as per API documentation.
- status string
Whether the page rule is active or disabled.
- actions
Dict[Page
Rule Actions] The actions taken by the page rule, options given below.
- target str
The URL pattern to target with the page rule.
- zone_
id str The DNS zone ID to which the page rule should be added.
- priority float
The priority of the page rule among others for this target, the higher the number the higher the priority as per API documentation.
- status str
Whether the page rule is active or disabled.
Outputs
All input properties are implicitly available as output properties. Additionally, the PageRule resource produces the following output properties:
Look up an Existing PageRule Resource
Get an existing PageRule resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: PageRuleState, opts?: CustomResourceOptions): PageRulestatic get(resource_name, id, opts=None, actions=None, priority=None, status=None, target=None, zone_id=None, __props__=None);func GetPageRule(ctx *Context, name string, id IDInput, state *PageRuleState, opts ...ResourceOption) (*PageRule, error)public static PageRule Get(string name, Input<string> id, PageRuleState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Actions
Page
Rule Actions Args The actions taken by the page rule, options given below.
- Priority int
The priority of the page rule among others for this target, the higher the number the higher the priority as per API documentation.
- Status string
Whether the page rule is active or disabled.
- Target string
The URL pattern to target with the page rule.
- Zone
Id string The DNS zone ID to which the page rule should be added.
- Actions
Page
Rule Actions The actions taken by the page rule, options given below.
- Priority int
The priority of the page rule among others for this target, the higher the number the higher the priority as per API documentation.
- Status string
Whether the page rule is active or disabled.
- Target string
The URL pattern to target with the page rule.
- Zone
Id string The DNS zone ID to which the page rule should be added.
- actions
Page
Rule Actions The actions taken by the page rule, options given below.
- priority number
The priority of the page rule among others for this target, the higher the number the higher the priority as per API documentation.
- status string
Whether the page rule is active or disabled.
- target string
The URL pattern to target with the page rule.
- zone
Id string The DNS zone ID to which the page rule should be added.
- actions
Dict[Page
Rule Actions] The actions taken by the page rule, options given below.
- priority float
The priority of the page rule among others for this target, the higher the number the higher the priority as per API documentation.
- status str
Whether the page rule is active or disabled.
- target str
The URL pattern to target with the page rule.
- zone_
id str The DNS zone ID to which the page rule should be added.
Supporting Types
PageRuleActions
- Always
Online string Whether this action is
"on"or"off".- Always
Use boolHttps Boolean of whether this action is enabled. Default: false.
- Automatic
Https stringRewrites Whether this action is
"on"or"off".- Browser
Cache stringTtl The Time To Live for the browser cache.
0means ‘Respect Existing Headers’- Browser
Check string Whether this action is
"on"or"off".- string
String value of cookie name to conditionally bypass cache the page.
- Cache
By stringDevice Type Whether this action is
"on"or"off".- Cache
Deception stringArmor Whether this action is
"on"or"off".- Cache
Key PageFields Rule Actions Cache Key Fields Args Controls how Cloudflare creates Cache Keys used to identify files in cache. See below for full description.
- Cache
Level string Whether to set the cache level to
"bypass","basic","simplified","aggressive", or"cache_everything".- string
String value of cookie name to conditionally cache the page.
- Cache
Ttl List<PageBy Statuses Rule Actions Cache Ttl By Status Args> Set cache TTL based on the response status from the origin web server. Can be specified multiple times. See below for full description.
- Disable
Apps bool Boolean of whether this action is enabled. Default: false.
- Disable
Performance bool Boolean of whether this action is enabled. Default: false.
- Disable
Railgun bool Boolean of whether this action is enabled. Default: false.
- Disable
Security bool Boolean of whether this action is enabled. Default: false.
- Edge
Cache intTtl The Time To Live for the edge cache.
- Email
Obfuscation string Whether this action is
"on"or"off".- Explicit
Cache stringControl Whether origin Cache-Control action is
"on"or"off".- Forwarding
Url PageRule Actions Forwarding Url Args The URL to forward to, and with what status. See below.
- Host
Header stringOverride Value of the Host header to send.
- Ip
Geolocation string Whether this action is
"on"or"off".- Minifies
List<Page
Rule Actions Minify Args> The configuration for HTML, CSS and JS minification. See below for full list of options.
- Mirage string
Whether this action is
"on"or"off".- Opportunistic
Encryption string Whether this action is
"on"or"off".- Origin
Error stringPage Pass Thru Whether this action is
"on"or"off".- Polish string
Whether this action is
"off","lossless"or"lossy".- Resolve
Override string Overridden origin server name.
- Respect
Strong stringEtag Whether this action is
"on"or"off".- Response
Buffering string Whether this action is
"on"or"off".- Rocket
Loader string Whether to set the rocket loader to
"on","off".- Security
Level string Whether to set the security level to
"off","essentially_off","low","medium","high", or"under_attack".- Server
Side stringExclude Whether this action is
"on"or"off".- Sort
Query stringString For Cache Whether this action is
"on"or"off".- Ssl string
Whether to set the SSL mode to
"off","flexible","full","strict", or"origin_pull".- True
Client stringIp Header Whether this action is
"on"or"off".- Waf string
Whether this action is
"on"or"off".
- Always
Online string Whether this action is
"on"or"off".- Always
Use boolHttps Boolean of whether this action is enabled. Default: false.
- Automatic
Https stringRewrites Whether this action is
"on"or"off".- Browser
Cache stringTtl The Time To Live for the browser cache.
0means ‘Respect Existing Headers’- Browser
Check string Whether this action is
"on"or"off".- string
String value of cookie name to conditionally bypass cache the page.
- Cache
By stringDevice Type Whether this action is
"on"or"off".- Cache
Deception stringArmor Whether this action is
"on"or"off".- Cache
Key PageFields Rule Actions Cache Key Fields Controls how Cloudflare creates Cache Keys used to identify files in cache. See below for full description.
- Cache
Level string Whether to set the cache level to
"bypass","basic","simplified","aggressive", or"cache_everything".- string
String value of cookie name to conditionally cache the page.
- Cache
Ttl []PageBy Statuses Rule Actions Cache Ttl By Status Set cache TTL based on the response status from the origin web server. Can be specified multiple times. See below for full description.
- Disable
Apps bool Boolean of whether this action is enabled. Default: false.
- Disable
Performance bool Boolean of whether this action is enabled. Default: false.
- Disable
Railgun bool Boolean of whether this action is enabled. Default: false.
- Disable
Security bool Boolean of whether this action is enabled. Default: false.
- Edge
Cache intTtl The Time To Live for the edge cache.
- Email
Obfuscation string Whether this action is
"on"or"off".- Explicit
Cache stringControl Whether origin Cache-Control action is
"on"or"off".- Forwarding
Url PageRule Actions Forwarding Url The URL to forward to, and with what status. See below.
- Host
Header stringOverride Value of the Host header to send.
- Ip
Geolocation string Whether this action is
"on"or"off".- Minifies
[]Page
Rule Actions Minify The configuration for HTML, CSS and JS minification. See below for full list of options.
- Mirage string
Whether this action is
"on"or"off".- Opportunistic
Encryption string Whether this action is
"on"or"off".- Origin
Error stringPage Pass Thru Whether this action is
"on"or"off".- Polish string
Whether this action is
"off","lossless"or"lossy".- Resolve
Override string Overridden origin server name.
- Respect
Strong stringEtag Whether this action is
"on"or"off".- Response
Buffering string Whether this action is
"on"or"off".- Rocket
Loader string Whether to set the rocket loader to
"on","off".- Security
Level string Whether to set the security level to
"off","essentially_off","low","medium","high", or"under_attack".- Server
Side stringExclude Whether this action is
"on"or"off".- Sort
Query stringString For Cache Whether this action is
"on"or"off".- Ssl string
Whether to set the SSL mode to
"off","flexible","full","strict", or"origin_pull".- True
Client stringIp Header Whether this action is
"on"or"off".- Waf string
Whether this action is
"on"or"off".
- always
Online string Whether this action is
"on"or"off".- always
Use booleanHttps Boolean of whether this action is enabled. Default: false.
- automatic
Https stringRewrites Whether this action is
"on"or"off".- browser
Cache stringTtl The Time To Live for the browser cache.
0means ‘Respect Existing Headers’- browser
Check string Whether this action is
"on"or"off".- string
String value of cookie name to conditionally bypass cache the page.
- cache
By stringDevice Type Whether this action is
"on"or"off".- cache
Deception stringArmor Whether this action is
"on"or"off".- cache
Key PageFields Rule Actions Cache Key Fields Controls how Cloudflare creates Cache Keys used to identify files in cache. See below for full description.
- cache
Level string Whether to set the cache level to
"bypass","basic","simplified","aggressive", or"cache_everything".- string
String value of cookie name to conditionally cache the page.
- cache
Ttl PageBy Statuses Rule Actions Cache Ttl By Status[] Set cache TTL based on the response status from the origin web server. Can be specified multiple times. See below for full description.
- disable
Apps boolean Boolean of whether this action is enabled. Default: false.
- disable
Performance boolean Boolean of whether this action is enabled. Default: false.
- disable
Railgun boolean Boolean of whether this action is enabled. Default: false.
- disable
Security boolean Boolean of whether this action is enabled. Default: false.
- edge
Cache numberTtl The Time To Live for the edge cache.
- email
Obfuscation string Whether this action is
"on"or"off".- explicit
Cache stringControl Whether origin Cache-Control action is
"on"or"off".- forwarding
Url PageRule Actions Forwarding Url The URL to forward to, and with what status. See below.
- host
Header stringOverride Value of the Host header to send.
- ip
Geolocation string Whether this action is
"on"or"off".- minifies
Page
Rule Actions Minify[] The configuration for HTML, CSS and JS minification. See below for full list of options.
- mirage string
Whether this action is
"on"or"off".- opportunistic
Encryption string Whether this action is
"on"or"off".- origin
Error stringPage Pass Thru Whether this action is
"on"or"off".- polish string
Whether this action is
"off","lossless"or"lossy".- resolve
Override string Overridden origin server name.
- respect
Strong stringEtag Whether this action is
"on"or"off".- response
Buffering string Whether this action is
"on"or"off".- rocket
Loader string Whether to set the rocket loader to
"on","off".- security
Level string Whether to set the security level to
"off","essentially_off","low","medium","high", or"under_attack".- server
Side stringExclude Whether this action is
"on"or"off".- sort
Query stringString For Cache Whether this action is
"on"or"off".- ssl string
Whether to set the SSL mode to
"off","flexible","full","strict", or"origin_pull".- true
Client stringIp Header Whether this action is
"on"or"off".- waf string
Whether this action is
"on"or"off".
- always
Online str Whether this action is
"on"or"off".- always
Use boolHttps Boolean of whether this action is enabled. Default: false.
- automatic
Https strRewrites Whether this action is
"on"or"off".- browser
Cache strTtl The Time To Live for the browser cache.
0means ‘Respect Existing Headers’- browser
Check str Whether this action is
"on"or"off".- str
String value of cookie name to conditionally bypass cache the page.
- cache
By strDevice Type Whether this action is
"on"or"off".- cache
Deception strArmor Whether this action is
"on"or"off".- cache
Key Dict[PageFields Rule Actions Cache Key Fields] Controls how Cloudflare creates Cache Keys used to identify files in cache. See below for full description.
- cache
Level str Whether to set the cache level to
"bypass","basic","simplified","aggressive", or"cache_everything".- str
String value of cookie name to conditionally cache the page.
- cache
Ttl List[PageBy Statuses Rule Actions Cache Ttl By Status] Set cache TTL based on the response status from the origin web server. Can be specified multiple times. See below for full description.
- disable
Apps bool Boolean of whether this action is enabled. Default: false.
- disable
Performance bool Boolean of whether this action is enabled. Default: false.
- disable
Railgun bool Boolean of whether this action is enabled. Default: false.
- disable
Security bool Boolean of whether this action is enabled. Default: false.
- edge
Cache floatTtl The Time To Live for the edge cache.
- email
Obfuscation str Whether this action is
"on"or"off".- explicit
Cache strControl Whether origin Cache-Control action is
"on"or"off".- forwarding
Url Dict[PageRule Actions Forwarding Url] The URL to forward to, and with what status. See below.
- host
Header strOverride Value of the Host header to send.
- ip
Geolocation str Whether this action is
"on"or"off".- minifies
List[Page
Rule Actions Minify] The configuration for HTML, CSS and JS minification. See below for full list of options.
- mirage str
Whether this action is
"on"or"off".- opportunistic
Encryption str Whether this action is
"on"or"off".- origin
Error strPage Pass Thru Whether this action is
"on"or"off".- polish str
Whether this action is
"off","lossless"or"lossy".- resolve
Override str Overridden origin server name.
- respect
Strong strEtag Whether this action is
"on"or"off".- response
Buffering str Whether this action is
"on"or"off".- rocket
Loader str Whether to set the rocket loader to
"on","off".- security
Level str Whether to set the security level to
"off","essentially_off","low","medium","high", or"under_attack".- server
Side strExclude Whether this action is
"on"or"off".- sort
Query strString For Cache Whether this action is
"on"or"off".- ssl str
Whether to set the SSL mode to
"off","flexible","full","strict", or"origin_pull".- true
Client strIp Header Whether this action is
"on"or"off".- waf str
Whether this action is
"on"or"off".
PageRuleActionsCacheKeyFields
-
Page
Rule Actions Cache Key Fields Cookie Args Controls what cookies go into Cache Key:
- Header
Page
Rule Actions Cache Key Fields Header Args Controls what HTTP headers go into Cache Key:
- Host
Page
Rule Actions Cache Key Fields Host Args Controls which Host header goes into Cache Key:
- Query
String PageRule Actions Cache Key Fields Query String Args Controls which URL query string parameters go into the Cache Key.
- User
Page
Rule Actions Cache Key Fields User Args Controls which end user-related features go into the Cache Key.
-
Page
Rule Actions Cache Key Fields Cookie Controls what cookies go into Cache Key:
- Header
Page
Rule Actions Cache Key Fields Header Controls what HTTP headers go into Cache Key:
- Host
Page
Rule Actions Cache Key Fields Host Controls which Host header goes into Cache Key:
- Query
String PageRule Actions Cache Key Fields Query String Controls which URL query string parameters go into the Cache Key.
- User
Page
Rule Actions Cache Key Fields User Controls which end user-related features go into the Cache Key.
-
Page
Rule Actions Cache Key Fields Cookie Controls what cookies go into Cache Key:
- header
Page
Rule Actions Cache Key Fields Header Controls what HTTP headers go into Cache Key:
- host
Page
Rule Actions Cache Key Fields Host Controls which Host header goes into Cache Key:
- query
String PageRule Actions Cache Key Fields Query String Controls which URL query string parameters go into the Cache Key.
- user
Page
Rule Actions Cache Key Fields User Controls which end user-related features go into the Cache Key.
-
Dict[Page
Rule Actions Cache Key Fields Cookie] Controls what cookies go into Cache Key:
- header
Dict[Page
Rule Actions Cache Key Fields Header] Controls what HTTP headers go into Cache Key:
- host
Dict[Page
Rule Actions Cache Key Fields Host] Controls which Host header goes into Cache Key:
- query
String Dict[PageRule Actions Cache Key Fields Query String] Controls which URL query string parameters go into the Cache Key.
- user
Dict[Page
Rule Actions Cache Key Fields User] Controls which end user-related features go into the Cache Key.
PageRuleActionsCacheKeyFieldsCookie
- Check
Presences List<string> Check for presence of specified HTTP headers, without including their actual values.
- Includes List<string>
Only use values of specified query string parameters in Cache Key.
- Check
Presences []string Check for presence of specified HTTP headers, without including their actual values.
- Includes []string
Only use values of specified query string parameters in Cache Key.
- check
Presences string[] Check for presence of specified HTTP headers, without including their actual values.
- includes string[]
Only use values of specified query string parameters in Cache Key.
- check
Presences List[str] Check for presence of specified HTTP headers, without including their actual values.
- includes List[str]
Only use values of specified query string parameters in Cache Key.
PageRuleActionsCacheKeyFieldsHeader
- Check
Presences List<string> Check for presence of specified HTTP headers, without including their actual values.
- Excludes List<string>
Exclude these query string parameters from Cache Key.
- Includes List<string>
Only use values of specified query string parameters in Cache Key.
PageRuleActionsCacheKeyFieldsHost
PageRuleActionsCacheKeyFieldsQueryString
- Excludes List<string>
Exclude these query string parameters from Cache Key.
- Ignore bool
false(default) - all query string parameters are used for Cache Key, unless explicitly excluded;true- all query string parameters are ignored; value is ignored if any ofexcludeorincludeis non-empty.- Includes List<string>
Only use values of specified query string parameters in Cache Key.
- Excludes []string
Exclude these query string parameters from Cache Key.
- Ignore bool
false(default) - all query string parameters are used for Cache Key, unless explicitly excluded;true- all query string parameters are ignored; value is ignored if any ofexcludeorincludeis non-empty.- Includes []string
Only use values of specified query string parameters in Cache Key.
- excludes string[]
Exclude these query string parameters from Cache Key.
- ignore boolean
false(default) - all query string parameters are used for Cache Key, unless explicitly excluded;true- all query string parameters are ignored; value is ignored if any ofexcludeorincludeis non-empty.- includes string[]
Only use values of specified query string parameters in Cache Key.
- excludes List[str]
Exclude these query string parameters from Cache Key.
- ignore bool
false(default) - all query string parameters are used for Cache Key, unless explicitly excluded;true- all query string parameters are ignored; value is ignored if any ofexcludeorincludeis non-empty.- includes List[str]
Only use values of specified query string parameters in Cache Key.
PageRuleActionsCacheKeyFieldsUser
- Device
Type bool true- classifies a request as “mobile”, “desktop”, or “tablet” based on the User Agent; defaults tofalse.- Geo bool
true- includes the client’s country, derived from the IP address; defaults tofalse.- Lang bool
true- includes the first language code contained in theAccept-Languageheader sent by the client; defaults tofalse.
- Device
Type bool true- classifies a request as “mobile”, “desktop”, or “tablet” based on the User Agent; defaults tofalse.- Geo bool
true- includes the client’s country, derived from the IP address; defaults tofalse.- Lang bool
true- includes the first language code contained in theAccept-Languageheader sent by the client; defaults tofalse.
- device
Type boolean true- classifies a request as “mobile”, “desktop”, or “tablet” based on the User Agent; defaults tofalse.- geo boolean
true- includes the client’s country, derived from the IP address; defaults tofalse.- lang boolean
true- includes the first language code contained in theAccept-Languageheader sent by the client; defaults tofalse.
- device
Type bool true- classifies a request as “mobile”, “desktop”, or “tablet” based on the User Agent; defaults tofalse.- geo bool
true- includes the client’s country, derived from the IP address; defaults tofalse.- lang bool
true- includes the first language code contained in theAccept-Languageheader sent by the client; defaults tofalse.
PageRuleActionsCacheTtlByStatus
PageRuleActionsForwardingUrl
- Status
Code int The status code to use for the redirection.
- Url string
The URL to which the page rule should forward.
- Status
Code int The status code to use for the redirection.
- Url string
The URL to which the page rule should forward.
- status
Code number The status code to use for the redirection.
- url string
The URL to which the page rule should forward.
- status
Code float The status code to use for the redirection.
- url str
The URL to which the page rule should forward.
PageRuleActionsMinify
Package Details
- Repository
- https://github.com/pulumi/pulumi-cloudflare
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
cloudflareTerraform Provider.