Home
Support Forums

Request http resource from https site using _redirects or other methods

Hi everyone,

I’m newbie with netlify. I would like some help regarding HTTP request. My web app is built with create-react-app and is deploy in https://chicago-pubtracker.netlify.app. The web application is trying to request http resource from http://www.ctabustracker.com/bustime/api/v2/getroutes?key=key&format=json from when the route is loaded in https://chicago-pubtracker.netlify.app/busRoutes .I’m using axios to request to this APIs but when I’m running it with netlify I’m getting ‘mixed content’ because I’m requesting HTTP resource when my site is served over HTTPS. I tried to contact and see if the APIs support HTTPs but they do not.

Most of the API has endpoints “ctabustracker.com/bustime/api/v2/*” with different query params
https://chicago-pubtracker.netlify.app/busRoutes request -> ctabustracker.com/bustime/api/v2/getRoutes?
https://chicago-pubtracker.netlify.app/destinations request -> ctabustracker.com/bustime/api/v2/getdirections? ->
https://chicago-pubtracker.netlify.app/getStops request ctabustracker.com/bustime/api/v2/getstops?

There are still other requests api which served under HTTP. I tried using the _redirects but for some reason it is not working or I am doing it wrong. It is based on other post but I can’t figure it out.
Below is the text I put in _redirects and it failed.
/busRoutes http://www.ctabustracker.com/bustime/api/v2/:splat 200

It says that there is no API key and it looks like that by doing the above it is redirecting exactly to the site because it doesn’t load my site but the http webservice. Please guide me on how to do http resource request. I appreciate your help.

Thank you.

@nitsua Welcome to the Netlify community.

Have you seen this post?

The solution offered is to use a redirect.

Hi gregraven,

Thank you. I was looking on this one also but now I finally get it. Thanks again.

1 Like