L
L
Lev K2017-07-17 17:34:13
JSON
Lev K, 2017-07-17 17:34:13

What needs to be done with nginx so that it gives .json files over https?

Hello.
I deal with https and ran into a problem that on the json page the file is loaded via http.
Because of this, a mixed content error occurs (in my opinion). I don't think this is correct.
In the code I write a relative path //mysite.dev/file.json
Apparently the problem is in nginx
This did not help:

server {
listen 443;
/*ssl*/ тут всякая ерунда про ssl
location ~ ^/(file.json) {
        try_files $uri $uri/ /index.php?$args; //yii2
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Morev, 2017-07-18
@amorev

Apparently, in your HTML code itself, the link to json is specified via http. https in Nginx needs to be configured for the entire domain, not for individual files.
PS. Use just two slashes (//) instead of http:// ( https://) in your code, then there will be a minimum of such problems. Good luck!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question