title: Wordpress behind nginx proxy - Loading failed for the <script> with source error
body: <p>Recenty I setup Nginx reverse proxy(container which provide https for all pages) and Wordpress container behind it with a lot of other services like Nextcloud.</p>
  
  <p>All services works fine except Wordpress which blocks css and js files by default when I access it through proxy but when I go to wordpress proxy, everything works(but only with http).</p>
  
  <p>I added this line to wp-config.php and this fixes css loading</p>
  
  <pre><code>if ( (!empty( $_SERVER['HTTP_X_FORWARDED_HOST'])) ||      (!empty( $_SERVER['HTTP_X_FORWARDED_FOR'])) ) {     $_SERVER['HTTPS'] = 'on'; }
  </code></pre>
  
  <p>But still I have errors with script loading - This errors are shown when I open console in Firefox</p>
  
  <pre><code>Blocked loading mixed active content "http://qqqqqqqq/wp-includes/js/wp-embed.min.js?ver=5.3.2"
  Loading failed for the &lt;script&gt; with source “http://qqqqqqqqq/wp-includes/js/wp-embed.min.js?ver=5.3.2”
  </code></pre>
  
  <p>I checked that this error(similar) shows in Firefox, Falkon and Brave.</p>
  
  <p><a href="https://i.stack.imgur.com/3x7pq.png" rel="nofollow noreferrer">Image with error(click here)</a></p>
  
  <p>This is my Nginx proxy setup</p>
  
  <pre><code>server {
  listen       443 ssl;
  server_name  site.pl www.site.pl;
  
  location / {
  resolver 127.0.0.11 valid=30s;
  set $upstream_server wordpress;
  
    proxy_pass http://$upstream_server:80;
          proxy_redirect     off;
          proxy_set_header   Host $host;
          proxy_set_header   X-Real-IP $remote_addr;
          proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header   X-Forwarded-Host $server_name;
  }
  error_page   500 502 503 504  /50x.html;
  location = /50x.html {
      root   /usr/share/nginx/html;
  }
  ssl_certificate /etc/letsencrypt/live/site.pl/cert1.pem;
  ssl_certificate_key /etc/letsencrypt/live/site.pl/privkey1.pem;
  }
  </code></pre>