Hi, @jasonwaters. If you look at the deploy details for the current published deploy, it also confirms only a single header rule is being processed:
-
1 new file uploaded
1 asset changed.
-
No redirect rules processed
This deploy did not include any redirect rules. Learn more about redirects.
-
1 header rule processed
All header rules deployed without errors.
-
All linked resources are secure
Congratulations! No insecure mixed content found in your files.
-
Build time: 4s. Total deploy time: 4s
I’m seeing two issues in netlify.toml
. I’ve included an example below. I see rules defined like this:
[[headers]]
for = "/*"
[headers.values]
Some-Header = "some value"
for = "/foo/*"
[headers.values]
Some-Header = "some value"
for = "/bar/*"
[headers.values]
Some-Header = "some value"
However, a new [[headers]]
line is needed before each rule like so instead:
[[headers]]
for = "/*"
[headers.values]
Some-Header = "some value"
[[headers]]
for = "/foo/*"
[headers.values]
Some-Header = "some value"
[[headers]]
for = "/bar/*"
[headers.values]
Some-Header = "some value"
Also, rules are checked in order. We recommend putting the most specific rules first. The *
in a header (or redirect) rule will match forward slashes.
This means that the first rule will match any request. It will always been the only rule used even if other, more specific, rules exist and apply. This is only because it is the first rule. If it were the last rule, it would not override the others.
To change that behavior, put rules in order of mosts specific first to least specific last. For example, rules like this:
[[headers]]
for = "/rule/most/specific/of/all"
[headers.values]
Some-Header = "value for that exact path"
[[headers]]
for = "/rule/most/specific/*"
[headers.values]
Some-Header = "value for any path begining /rule/most/specific/" # (except "/rule/most/specific/of/all")
[[headers]]
for = "/rule/*"
[headers.values]
Some-Header = "value for any path begining /rule/" # (except the ones above)
[[headers]]
for = "/foo/*"
[headers.values]
Some-Header = "value for /foo/"
[[headers]]
for = "/bar/*"
[headers.values]
Some-Header = "value for /bar/"
[[headers]]
for = "/*"
[headers.values]
Some-Header = "value for all the rest"
If that doesn’t work or if there are other questions, please let us know.