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


#1

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


#2

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


#3

@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?


#4

@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.


#5

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).


#6

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: https://en.wikipedia.org/wiki/Web_scraping

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


#7

I am using Netlify to deploy the Jekyll website


#8

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