How to add Access-Control-Allow-Origin in feed?

How to add Access-Control-Allow-Origin in feed?

That’s something you have to configure with your server software. Try searching for “enable CORS {server software}”.

@yashumittal, +1 to what @chromatical has suggested - you’re looking to tweak web server configuration to add Access-Control-Allow-Origin header to the response of your feed. If you’re using Github or Netlify, I believe the game is over - they don’t serve your content, instead their CDN (or CDN-partner) does and CDN is usually concerned with speedy delivery not flexibility.

Out of curiosity, what would you use that header for?

@pabloduo, I want to pull some data from the feed and show the same data on website.

Do you know any other way to pull the data from a feed.

Out of curiosity I did some research and found that GitHub Pages actually does support CORS and Netlify appears to support custom headers, so not all is lost if you are using one of them (though Netlify requires some extra configuration).

1 Like

You can try scraping your own site but that’s ugly and might break in the future if the structure of resulting HTML page has changed… However, as @chromatical has suggested GHP supports CORS out of the box and other folks give you options to configure custom headers as well.

Here you can read more:

Also, are you running Jekyll yourself on your own server or somewhere else?

I am using Netlify to deploy the Jekyll website

Okay, seems like Netlify has an option to configure headers you need for your use case.