How to properly hardcode a request from https to http?

  • 0
    Hello main server closed with ssl certificate and translated 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 swore that you can't 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 an HTTP call to the API written 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?
    JavaScript Anonymous, Jun 9, 2020

  • 5 Answers
  • 0
    Don't suffer ...

    Transfer back to https

    This can be done and, moreover, in most mana for nginx they do this, BUT as you noticed the backing must have https, otherwise you will always catch such crap.
    Emmett Hansen

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


    This is the opposite of what you want. You tell the browser if it encounters a request via http to make it via https
    Aaron Chang

  • 0
    At the current stage, there is no desire to transfer the scope server to https


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

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

  • 0
    Moved scope to https ....
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!