How to send http request


(SMHassanAlavi) #1

Hi.
I want to send http get request but discourse doesn’t allow me to send it and I see this error while sending this in firebug:
locked loading mixed active content
but I doesn’t have any problem with https request.
Our site is : https://padpors.com
what should I do for sending http request?


(Blake Erickson) #2

Can you explain a little more what you are trying to do?

Are you trying to link to an image on another http url?

If so I would recommend just uploading that image to discourse and then you don’t have to worry about in mixed content warnings.


(SMHassanAlavi) #3

no this isn’t an image.
I want to run this script:

$.getJSON("http://155.84.104.53:9295/ingest?id=100&url='padpors103'", function (data) { });
</script>```
I have puted this in header. It works in my local discourse but doesn't work in main site because of this error:
```locked loading mixed active content```
when I change the script to :
```<script>
$.getJSON("//155.84.104.53:9295/ingest?id=100&url='padpors103'", function (data) { });
</script>``` 
or 
```<script>
$.getJSON("https://155.84.104.53:9295/ingest?id=100&url='padpors103'", function (data) { });
</script>```
the script works but send it through https protocol and the target sever doesn't support https request.
what should I do to send it through http protocol?

(Felix Freiberger) #4

That’s not possible – browsers will reject that, as you have seen. You must load the remote script via HTTPS, or serve your site via HTTP (which I absolutely do not recommend).


(SMHassanAlavi) #5

now what should I do. api we use just has HTTP and ignore the HTTPS request.I should send my request through HTTP .


(Felix Freiberger) #6

Maybe ask the API provider to support HTTPS (which will require the use of a domain)?


(SMHassanAlavi) #7

I have asked them but they say because of price we don’t support HTTPS request


(Felix Freiberger) #8

Then you’re out of luck. Either move your site to HTTP (which basically destroys its security), find a different API provider if possible, or build a workaround – maybe you can proxy these requests via your server?


(Régis Hanol) #9

Tell them about https://letsencrypt.org/ which provides free SSL certificates :wink:


(Philip Newton) #10

Though it’s only free as in money – it still costs time to set up and make sure it works correctly. (And time is often money as well, if the person doing this does it as part of their job.)