# Requesting an HTTP resource from HTTPS Website (again)

**URL:** <https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524>\
**Category:** Support\
**Tags:** redirects, netlify-newbie, netlify-dns-https-ssl\
**Created:** [August 10, 2020, 9:15pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524 "2020-08-10T21:15:36Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![hector4213](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hector4213/32/14456_2.png) [@hector4213](https://answers.netlify.com/u/hector4213)\
**Post date:** [August 10, 2020, 9:15pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/1 "2020-08-10T21:15:36Z")

</div>

Hello everyone, I am experiencing an issue that has been solved on here but i am unfamiliar with the syntax and usage of the redirects. I have an endpoint that i am using for my app that is http based and get the classic “Chrome: Mixed Content: The page at ‘’ was loaded over HTTPS, but requested an insecure resource ‘’. This request has been blocked; the content must be served over HTTPS.”

I understand this is due to the endpoint being served over HTTP, and not HTTPS which causes an issue in mixed content. My issue is implementing the solution kindly answered here [Requesting an HTTP resource from HTTPS Website](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website/8510)

Where exactly do i implement the redirect? Do i have to make a toml file? My endpoint in axios is ‘[http://webservices.nextbus.com/service/publicJSONFeed](http://webservices.nextbus.com/service/publicJSONFeed)’, the solution that was posted above mentioned to use this /\* [http://webservices.nextbus.com/service/:splat](http://webservices.nextbus.com/service/:splat) 200 in the redirect rule.

I have no idea where to place the rule, and lets say i did implement the rule would it look like this "/\* [http://webservices.nextbus.com/service/publicJSONFeed:splat](http://webservices.nextbus.com/service/publicJSONFeed:splat) 200? Im just very unsure and would hope someone could point me in the right direction. Thanks so much for your time!

---

<div class="post-metadata">

**Author:** ![gregraven](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/gregraven/32/23821_2.png) [@gregraven](https://answers.netlify.com/u/gregraven)\
**Post date:** [August 11, 2020, 3:47am UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/2 "2020-08-11T03:47:20Z")

</div>

@hector4213 Welcome to the Netlify community.

That particular code must reside in a \_redirects file in the top level of your website.

You can also translate it and add it to your netlify.toml file, the easiest way of doing so would be to use the Play page. Plug in your redirects code, and out will come your .toml equivalent.

[https://play.netlify.com/redirects](https://play.netlify.com/redirects)

---

<div class="post-metadata">

**Author:** ![hector4213](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hector4213/32/14456_2.png) [@hector4213](https://answers.netlify.com/u/hector4213)\
**Post date:** [August 11, 2020, 3:18pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/3 "2020-08-11T15:18:13Z")

</div>

Thanks for your kind reply!

I made a netlify.toml file in my project, this is what i have so far…I have a feeling i am entering something incorrectly as i still get the cors error in my console.

[[redirects]]  
from = “[http://webservices.nextbus.com/service/publicJSONFeed](http://webservices.nextbus.com/service/publicJSONFeed)”  
to = “/\* [http://webservices.nextbus.com/service/publicJSONFeed:splat](http://webservices.nextbus.com/service/publicJSONFeed:splat) 200”  
status = 200  
force = true

Could it be the URL i am entering that is incorrec?, my baseURL for my api endpoint is the “from” parameter of the redirect in my toml file.

---

<div class="post-metadata">

**Author:** ![gregraven](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/gregraven/32/23821_2.png) [@gregraven](https://answers.netlify.com/u/gregraven)\
**Post date:** [August 11, 2020, 3:31pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/4 "2020-08-11T15:31:26Z")

</div>

@hector4213 Even without knowing the details, it would seem that the redirect should look more like this:

```auto
[[redirects]]
from = “http://webservices.nextbus.com/service/publicJSONFeed/*”
to = “http://webservices.nextbus.com/service/publicJSONFeed:splat”
status = 200
force = true

```

---

<div class="post-metadata">

**Author:** ![fool](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/fool/32/37_2.png) [@fool](https://answers.netlify.com/u/fool)\
**Post date:** [August 13, 2020, 12:40am UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/5 "2020-08-13T00:40:41Z")

</div>

As far as I can tell, we don’t host `webservices.nextbus.com` so our redirects wouldn’t have any impact on that traffic. We also won’t ever accept an HTTP connection without redirecting it to HTTPS before applying redirects, as far as I know.

I think you’d want something more like this as a redirect:

```auto
[[redirects]]
from = "/path-at-netlify"
to = "http://webservices.nextbus.com/service/publicJSONFeed"
status = 200
force = true

```

This lets us accept the request as [https://yournetlifysite/path-at-netlify](https://yournetlifysite/path-at-netlify) and then makes an http connection to your endpoint silently - the browser won’t know what we do “behind the curtain”. 🙂

---

<div class="post-metadata">

**Author:** ![hector4213](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hector4213/32/14456_2.png) [@hector4213](https://answers.netlify.com/u/hector4213)\
**Post date:** [August 17, 2020, 4:39am UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/6 "2020-08-17T04:39:14Z")

</div>

Thanks for your help @fool but i still get the same error. Perhaps I am not providing enough background information or probably incorrect information. I have to apologise for the trouble. Perhaps you could look at my code? if thats not too much trouble? I am a beginner developer who is self-learning and hopefully gain entry as a front end web developer, but this CORS issue is going to give me a stroke!

> <https://github.com/hector4213/6ixbus/blob/master/src/api/nextbus.js>

---

<div class="post-metadata">

**Author:** ![perry](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/perry/32/16_2.png) [@perry](https://answers.netlify.com/u/perry)\
**Post date:** [August 21, 2020, 5:22pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/7 "2020-08-21T17:22:37Z")

</div>

howdy hector, just a heads up that fool is out on PTO this week but back next week.

Question: is there any way to get the endpoint to run over https instead?

---

<div class="post-metadata">

**Author:** ![hector4213](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hector4213/32/14456_2.png) [@hector4213](https://answers.netlify.com/u/hector4213)\
**Post date:** [August 21, 2020, 8:23pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/8 "2020-08-21T20:23:28Z")

</div>

Thanks @perry for the update, got a little sad when I had no reply. I appreciate the support it really distinguishes netlify from other service. The community is so helpful, especially through my noob struggles.

---

<div class="post-metadata">

**Author:** ![perry](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/perry/32/16_2.png) [@perry](https://answers.netlify.com/u/perry)\
**Post date:** [August 21, 2020, 8:25pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/9 "2020-08-21T20:25:42Z")

</div>

of course! we do try and provide some answer to everyone who writes in, but with only 8 of us to take care of hundreds of thousands of free customers (and enterprise businesses who pay us a lot!) it can get too busy sometimes and we get delayed. But i bet we can find a solution to your problem soon, and thanks for the kind words.

We’ve tried really hard to make our support forums kind & friendly to everyone, we don’t think it is helpful when people are too intimidated to ask questions because they are new!

---

<div class="post-metadata">

**Author:** ![perry](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/perry/32/16_2.png) [@perry](https://answers.netlify.com/u/perry)\
**Post date:** [August 21, 2020, 8:35pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/10 "2020-08-21T20:35:03Z")

</div>

i wonder if @jonsully has any thoughts on this? he’s usually full of good advice!

---

<div class="post-metadata">

**Author:** ![jonsully](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jonsully/32/15053_2.png) [@jonsully](https://answers.netlify.com/u/jonsully)\
**Post date:** [August 21, 2020, 8:48pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/11 "2020-08-21T20:48:58Z")

</div>

Hi Friends! 👋🏻

@hector4213 if the question is “Is it possible to use Netlify as a proxy service to mask that an underlying service isn’t served over HTTPS yet” the answer is yes… with caveats. My first question would be the same as @fool’s - Netlify’s redirects service is made to work for sites that are hosted on Netlify. Is your site hosted on Netlify? Or are you just wanting to use Netlify as a total stand-alone proxy?

–  
Jon

Welcome back @perry 🙂

---

<div class="post-metadata">

**Author:** ![hector4213](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hector4213/32/14456_2.png) [@hector4213](https://answers.netlify.com/u/hector4213)\
**Post date:** [August 21, 2020, 9:44pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/12 "2020-08-21T21:44:28Z")

</div>

Yes. The app is hosted on netlify. [https://6ixbus.netlify.app](https://6ixbus.netlify.app)

---

<div class="post-metadata">

**Author:** ![jonsully](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/jonsully/32/15053_2.png) [@jonsully](https://answers.netlify.com/u/jonsully)\
**Post date:** [August 21, 2020, 10:01pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/14 "2020-08-21T22:01:52Z")

</div>

Oh I see.

[http://webservices.nextbus.com/service/publicJSONFeed](http://webservices.nextbus.com/service/publicJSONFeed) is the HTTP data feed that’s blocked. Easy peasy!

It looks like you prefer the netlify.toml file format instead of `_redirects` - here’s what you’ll want:

```plaintext
[[redirects]]
  from = "/feed/*"
  to = "http://webservices.nextbus.com/service/:splat"
  status = 200
  force = true

```

So once you have that, instead of having the javascript on your page reach out to [http://webservices.nextbus.com/service/publicJSONFeed](http://webservices.nextbus.com/service/publicJSONFeed), just have it reach out to `/feed/publicJSONFeed` (an absolute path on your own domain) and it should work perfectly well.

What’s happening is that the redirect `from` option will intercept any request going to `https://6ixbus.netlify.app/feed/______` and, because we use a `status = 200` aka a [rewrite](https://docs.netlify.com/routing/redirects/rewrites-proxies/) - the Netlify node that’s handling the redirect will reach out to the target ([http://webservices.nextbus.com/service/\_\_\_\_\_\_](http://webservices.nextbus.com/service/______)) then pass the result back to the caller directly, not through a 301 or 302 -style redirect. It’s faking as if your site has that data on that `feed/ ______ ` path of its own 💯 super powerful concept and tool from Netlify!

Let me know if that works 🙂

–  
Jon

---

<div class="post-metadata">

**Author:** ![hector4213](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hector4213/32/14456_2.png) [@hector4213](https://answers.netlify.com/u/hector4213)\
**Post date:** [August 23, 2020, 8:05pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/15 "2020-08-23T20:05:12Z")

</div>

Thanks, ill get to work on changing that and i will let you know how it goes! I appreciate all the help.

---

<div class="post-metadata">

**Author:** ![hector4213](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hector4213/32/14456_2.png) [@hector4213](https://answers.netlify.com/u/hector4213)\
**Post date:** [August 28, 2020, 7:28pm UTC](https://answers.netlify.com/t/requesting-an-http-resource-from-https-website-again/20524/16 "2020-08-28T19:28:21Z")

</div>

@jonsully Thanks so much for all your help! It works beautifully! I’m elated. I’m trying to learn everything on my own to become a web dev and I appreciate the community for their many attempts at helping me with my problem. Thanks everyone from @perry and fool. I would of never imagined people being so helpful, I should stop hanging out on stack overflow. Anyways my apps works beautifully and I can’t stress enough how much this means to me. Thanks for the bottom of my heart. Hope to use netlify again for my other React Projects.
