Headers are not being applied from either netlify.toml or _headers files

I’m trying to make rss feed file available using a url with no file extension.

e.g. https://links-static.markjgsmith.com/feeds/daily/rss

I can’t get the headers to apply.

I found this relevant forum post where op had issues with netlify.toml, but neither config file work in my case.

netlify.toml (in root of project):

[[headers]]
  for = "/feeds/daily/rss/index.html"
  [headers.values]
    Content-Type = "text/xml"

[[headers]]
  for = "/feeds/daily/atom/index.html"
  [headers.values]
    Content-Type = "text/xml"

[[headers]]
  for = "/feeds/daily/json/index.html"
  [headers.values]
    Content-Type = "application/json"

_headers (in root of deployed folder):

/feeds/daily/rss/index.html
  Content-Type: "text/xml"
/feeds/daily/atom/index.html
  Content-Type: "text/xml"
/feeds/daily/json/index.html
  Content-Type: "application/json"

In both cases the files are still text/html files when I download them in a browser.

What am I doing wrong?

As far as I can tell, those headers wouldn’t apply to those files.

When someone loads https://yoursite.com/feeds/daily/rss

we won’t look to set the header based on a rule that targets instead:

/feeds/daily/rss/index.html

What happens when you try to apply the header to /feeds/daily/rss ?

Thanks - that worked, I used the following settings in netlify.toml:

[[headers]]
  for = "/feeds/daily/rss"
  [headers.values]
    Content-Type = "text/xml"

[[headers]]
  for = "/feeds/daily/atom"
  [headers.values]
    Content-Type = "text/xml"

[[headers]]
  for = "/feeds/daily/json"
  [headers.values]
    Content-Type = "application/json"

Now all the rss feeds have the right content-type on download.

Thanks for sharing the solution that worked for you, @mjgs. We greatly appreciate it! :smiley: