N
N
Nikolay Baranenko2020-10-30 21:49:08
JavaScript
Nikolay Baranenko, 2020-10-30 21:49:08

How to hardcode a request from https to http?

Hello, the main server is closed with an ssl certificate and transferred to https

At the current stage, there is no desire to transfer the scope server to https, so it is still http.

At first, JS cursed that it was impossible to mix HTTP with HTTP

Mixed Content: The page at 'https://host1/chart_datetime?id_scope_dir=1&id_scope_describe=p…bizml.ru&datetime_start=2020-10-30%2020:46&datetime_end=2020-10-30%2021:01' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://host2/scope/store_by_datetime?id_scope_dir=1&datetime_start=2020-10-30%2020:46&datetime_end=2020-10-30%2021:01'. This request has been blocked; the content must be served over HTTPS.


found and applied the recommendation

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">


BUT now I have a call to the API via HTTP in my code, it converts it to HTTPS.

https://host2/scope/store_by_datetime?id_scope_dir=1&datetime_start=2020-10-30%2021:19&datetime_end=2020-10-30%2021:34


although the code says HTTP

var url ='http://host2/scope/store_by_datetime?id_scope_dir='+id_scope_dir+'&datetime_start='+datetime_start+'&datetime_end='+datetime_end


What is the best way to temporarily solve this problem?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
V
Viktor Taran, 2020-11-01
@drno-reg

Don't suffer... You can do it in the majority of nginx mans, BUT as you noticed, the backing must have https otherwise you will always catch such crap
.

K
krundetz, 2020-10-30
@krundetz

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

This is the opposite of what you need. You tell the browser if it encounters an http request, make it https.

K
ky0, 2020-10-30
@ky0

At the current stage, there is no desire to translate the scope server to https

I would wait until the desire appears. For some reason you want to reverse the process of evolution :)

N
Nadim Zakirov, 2020-10-31
@zkrvndm

Just connect Cloudflate, it can proxy https when accessing http.

N
Nikolay Baranenko, 2020-11-02
@drno-reg

Changed scope to https....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question