Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github pages website is on HTTPS but Rest API is on HTTP

I have github pages website which makes request to a hosted server which is HTTP and my browser blocks it.

Its assignment for university so I don't really want to pay for HTTPS on the server and I can't use something else for the front-end as I have sent the url to my professor expecting that this is where my web app will be hosted.

Is there anything I can do, which doesn't involve paying that much money?

like image 850
Pavlin Petkov Avatar asked Dec 22 '17 10:12

Pavlin Petkov


People also ask

Does GitHub Pages support HTTP?

About HTTPS and GitHub PagesAll GitHub Pages sites, including sites that are correctly configured with a custom domain, support HTTPS and HTTPS enforcement.

Can you deploy an API on GitHub Pages?

The deployments API allows you to create and delete deploy keys, deployments, and deployment environments.

Why is GitHub not showing my website?

To get your site working again you'll need to make sure your repository is set to public again, head to the repository settings page, make sure that GitHub Pages is enabled, then push a fresh commit to your repository.

Does GitHub Pages support JSON?

By using Github, we can host our JSON files data there, because it is a static site, the only limitation is that it only supports GET requests.


1 Answers

I encountered this same issue when making API calls. Here's an easy workaround:

  1. Get your api endpoint (for this example, let’s say http://api.catphotos.io/)
  2. Prepend the CORS API link https://cors-anywhere.herokuapp.com/ to your link
  3. Make sure to leave the http:// on your endpoint.
  4. Your new link should look like this: https://cors-anywhere.herokuapp.com/http://api.catphotos.io/
  5. Make your API calls with your new link!

Source: johnalcher.me

like image 53
J.S. Peterson Avatar answered Oct 22 '22 14:10

J.S. Peterson