Quantcast
Channel: Setting response headers only on documents
Browsing latest articles
Browse All 25 View Live

Setting response headers only on documents

I need to be able to do this as well. Webhint complain that CSP headers are being on unnecessary assets like CSS files, images etc, when all I need is for them to be on documents. Read full topic

View Article



Setting response headers only on documents

If you have a CDN in front of your Netlify deployment, you might be able to strip headers from static asset requests. E.g. here is a CloudFlare Worker which does this on simonhearne.com:...

View Article

Image may be NSFW.
Clik here to view.

Setting response headers only on documents

I also would like to add CSP and other headers only to HTML resources, most of which are loaded with URL ending with ‘/’, not ‘.html’, so I hope there will be a solution soon. SimonHearne: It doesn’t...

View Article

Setting response headers only on documents

We’ve added all of your views to an open feature request. If/when this is evaluated, we’ll let you know! Read full topic

View Article

Setting response headers only on documents

Why it is not working in my case. `[[headers]] for = “/*.js” [headers.values] cache-control = “max-age=31536000” for = "/*.css" [headers.values] cache-control = "max-age=31536000" for = "/*.woff"...

View Article


Setting response headers only on documents

Hi, @Nakib, would you please send us the URL where the header isn’t working? If you do so, we’ll be happy to take a look to see what is happening and why. Read full topic

View Article

Setting response headers only on documents

I have changed the .toml file a little and now it is working for all files except .html files. My site: https://tender-ramanujan-0bcb6d.netlify.app/. So please check why it is not working for .html...

View Article

Image may be NSFW.
Clik here to view.

Setting response headers only on documents

Hey @Nakib, I believe we answered your above question over here: Format of custom headers glob Support Why it is not working in my case. `[[headers]] for = “/*.js” [headers.values] cache-control =...

View Article


Image may be NSFW.
Clik here to view.

Setting response headers only on documents

As for the *.html files, you will not be able to accomplish what you want today. so… are we there yet? lighthouse complains about a malformed robots.txt due to preload headers with a /* rule. Read...

View Article


Setting response headers only on documents

Unfortunately not! Though, you may be able to circumvent the error by specifying more specific paths (assuming not all .html files are in your root directory). Read full topic

View Article

Setting response headers only on documents

then you should allow for _headers templating. correct me if i’m wrong but, your documentation says you will look in the publish dir for the _headers file, but if i template it, let’s say with jekyll,...

View Article

Image may be NSFW.
Clik here to view.

Setting response headers only on documents

Not too sure what you’re templating, I’m afraid! Feels a little bit redundant however maybe I’m missing a part of your workflow? My suggestion was that, in your _headers file, you could have something...

View Article

Setting response headers only on documents

i added a blank line and it seems to be working now… the root _headers file looks like this: --- layout: null --- {%- assign urls = site.pages | map: 'url' | sort -%} {%- for url in urls %} {%- if url...

View Article


Setting response headers only on documents

spoke too soon… it’s not working… although the generated /site/_headers seems fine. and if i take the result of this template and paste it in the root _headers file it works. Read full topic

View Article

Setting response headers only on documents

Hi @cdeath, Could you share the repo? As long as the headers file is getting correctly generated in the publish path, it should work fine. Read full topic

View Article


Setting response headers only on documents

i don’t have permissions for it… sorry… but i’ll try to replicate this in another repo and invite you later. Read full topic

View Article

Setting response headers only on documents

This has become a major blocker on the project I’m working on (and a huge headache for our users) and I’m really hoping I’m just missing something obvious. We have a SPA built using SvelteKit. All...

View Article


Setting response headers only on documents

Hi @greyivy, The only way at the moment that would work for you is to write a template that would generate the required headers for all the paths. So, your build command would generate the required...

View Article

Setting response headers only on documents

Is there any progress on this? Read full topic

View Article

Setting response headers only on documents

Hi @okikio, Unfortunately, no. The only solution is the one before your reply other than manually typing all the values. Read full topic

View Article

Setting response headers only on documents

I hope netlify implements this feature soon. Read full topic

View Article


Setting response headers only on documents

Any word on this? IIUC, it is still not possible to set headers specifically and only for requests that do not end in an extension, like .html, or a slash and do not have a common prefix to match...

View Article


Setting response headers only on documents

HTML is the only extension that can’t be set headers for. Otherwise, you can do something like /*.[ext] and it works. Read full topic

View Article

Setting response headers only on documents

For anyone stumbling upon this thread in 2022, we can now fix this issue for ourselves using a Netlify Edge Function! I wrote a blog post on this approach and included a code snippet that you can grab...

View Article

Image may be NSFW.
Clik here to view.

Setting response headers only on documents

Thank you for coming back and sharing this-- this will definitely be beneficial to future Forums members who encounter this obstacle. Happy building Read full topic

View Article

Browsing latest articles
Browse All 25 View Live




Latest Images