Radzhab
@Radzhab

Nginx не дает грузить файлы со стороннего ресурса?

Перенес сайт на https. После этого все картинки на сайте которые грузятся по http не отображаются. Пишет следующую ошибку в консоли

This request has been blocked; the content must be served over HTTPS.
Вот конфиг

upstream puma {
  server unix:///home/deploy/apps/rifc/shared/tmp/sockets/rifc-puma.sock;
}


# Редирект с www.xxx.su.com на xxx.su.com при любом протоколе
server {
  listen 80;
  server_name www.xxx.su;
  return 301 $scheme://xxx.su$request_uri;
}

# Редирект с http на https
server {
  listen 80;
  server_name xxx.su;
  return 301 https://xxx.su$request_uri;
}


server {
  listen 443 ssl http2;
  server_name xxx.su;
  rewrite ^/(.*)/$ /$1 permanent;

  client_max_body_size 4G;
  keepalive_timeout 10;
  root /home/deploy/apps/rifc/current/public;
  error_page 500 502 503 504 /500.html;
  try_files $uri @puma;

  add_header Content-Security-Policy "block-all-mixed-content";
  add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
  add_header X-Content-Type-Options nosniff;
  add_header X-Frame-Options DENY;
  resolver 127.0.0.1 8.8.8.8;
  ssl on;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_session_cache shared:SSL:10m;
  ssl_session_timeout 5m;
  ssl_stapling on;
  ssl_stapling_verify on;
  ssl_certificate /etc/letsencrypt/live/xxx.su/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/xxx.su/privkey.pem;
  ssl_trusted_certificate /etc/letsencrypt/live/xxx.su/chain.pem;

  location @puma{
    access_log /home/deploy/apps/rifc/current/log/nginx.access.log;
    error_log /home/deploy/apps/rifc/current/log/nginx.error.log info;

    limit_req zone=one burst=3;
    proxy_pass  http://puma;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_http_version 1.1;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header X-Real-IP $remote_addr;
  }

  location /.well-known {
    root /var/www/html;
  }



  if ($request_method !~ ^(GET|HEAD|PUT|PATCH|POST|DELETE|OPTIONS)$ ){
    return 405;
  }
}

Как решить эту проблему?
  • Вопрос задан
  • 113 просмотров
Пригласить эксперта
Ответы на вопрос 1
@Batlab
PHP Senior | Python Middle | JS Junior
Перепишите все картинки по https
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы