title: Kibana stuck on loading screen [UPDATE - Nginx only serving partial JS file]
body: <p>Kibana is not starting up properly. When I open up the console it appears to be a javascript resource issue. When I open the js files directly (clicking on their link in the console) it appears they are incomplete and have been abruptly been cut off. Not sure if this is a browser file limit or somehow my files have been cut off? Please see the images below to show you what Im seeing.    </p>
  
  <p><a href="https://i.stack.imgur.com/TL4W7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TL4W7.png" alt="Kibana stuck on loading screen"></a></p>
  
  <p>File as seen in chrome. This is the very bottom of the file as per how chrome loads it.</p>
  
  <p><a href="https://i.stack.imgur.com/SQVWp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SQVWp.png" alt="commons.bundle.js"></a></p>
  
  <p>I have restarted kibana to see if that would resolve it, no luck.</p>
  
  <p>I think browsers have a max line limit in js files. I am not sure why kibana hasn't minified the js files? has it started up in some dev mode?</p>
  
  <p><strong>question summary</strong></p>
  
  <p>I guess I have discovered the reason for kibana not loading is because of the js not fully loading, this would change my question to how can I get all of my javascript to load?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I have located the JS files in the kibana bundles folder and found that the file is fully intact. It is indeed a browser loading complete file issue. I'm confused why suddenly those files are too long to be loaded by the browser? Was working fine a fortnight ago. Still trying to work out how I can get chrome to load the files.</p>
  
  <p>As suggested by @asettouf I have removed(backed up) <code>bundles</code> folder in the <code>/opt/kibana/optimize</code> directory and started kibana up again. This did re-generate the <code>bundles</code> folder but the files are identical, meaning I still have the same issue. How come Kibana is not minifying the js when it bundles the files for caching?</p>
  
  <p>My <strong>kibana.yml</strong>. I think it is cleaner to paste a link to it:</p>
  
  <blockquote>
    <p><a href="http://www.heypasteit.com/clip/O8HUN" rel="nofollow noreferrer">http://www.heypasteit.com/clip/O8HUN</a></p>
  </blockquote>
  
  <p>went back turned on verbose logging and this is my output from deleting optimize folder and restarting. nothing stands out as an error message to me.</p>
  
  <p><strong>/var/log/kibana/kibana.log</strong> </p>
  
  <p>replaced hostname with localhost for privacy and security reasons</p>
  
  <blockquote>
    <p><a href="http://www.heypasteit.com/clip/OA4OR" rel="nofollow noreferrer">http://www.heypasteit.com/clip/OA4OR</a></p>
  </blockquote>
  
  <p>I think this is an error with the webpack module not compiling the JS correctly. however i dont know enough about the module to debug it. </p>
  
  <p>the files in question in the optimize folder are:</p>
  
  <p><strong>commons.bundle.js</strong> which is <strong>65723 lines</strong></p>
  
  <p><strong>kibana.bundle.js</strong> at <strong>108950 lines</strong></p>
  
  <p>These are far from optimized and the content inside the files are not minified.</p>
  
  <p>Result of <code>curl -v localhost:5601</code></p>
  
  <blockquote>
    <p><a href="http://www.heypasteit.com/clip/OEKEX" rel="nofollow noreferrer">http://www.heypasteit.com/clip/OEKEX</a></p>
  </blockquote>
  
  <p><strong>CURL REQUEST DIRECTLY TO KIBANA JS RESOURCES</strong></p>
  
  <p>I can confirm that <code>curl -ukibanaadmin -v http://localhost/bundles/commons.bundle.js</code> returns me the full 108950 lined JS file and <code>curl -ukibanaadmin -v http://actual_kibana_hostname/bundles/commons.bundle.js</code> returns the same content (number of lines) as my browser. </p>
  
  <p>With that information I can make the assumption that this is not a Kibana issue  at all. As mentioned by @val it is probably a setting in nginx that is preventing the entire file from being served unless accessed by localhost. </p>
  
  <p>I think I can rule out Cloudflare as I still get the issue when I hit my server directly from the browser.</p>
  
  <p><strong>Thanks</strong>  to everyone's suggestions and help so far. Getting closer and closer to solving my issue. I will do some more research on Nginx and its settings. </p>
  
  <p><strong>NGINX UPDATE</strong></p>
  
  <p>Nginx appears to only be loading the first 72kbs of my havascript files. Ive search all around  my nginx config files and cannot see this setting anywhere. Ive added things like </p>
  
  <pre><code>location / {
      ...
      proxy_max_temp_file_size 1m;
      ...
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>location / {
      ...
      sendfile on;
      sendfile_max_chunk 1m;
  
      ...
  }
  </code></pre>
  
  <p>But still I'm unable to overwrite this weird setting that is only allowing first part of file being loaded.</p>
  
  <p>The connection uses nginx <code>proxy_pass</code> to foward port <code>80</code> to kibanas port '5601'. I feel like there could be a setting that limits file transfer over proxy? just not sure where to find it.</p>
  
  <p>proxypass connection looks like:</p>
  
  <pre><code>server {
      listen 80;
  
      server_name logs.mydomain.com;
  
      auth_basic "Restricted Access";
      auth_basic_user_file /etc/nginx/htpasswd.users;
  
      location / {
          proxy_pass http://localhost:5601;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection 'upgrade';
          proxy_set_header Host $host;
          proxy_cache_bypass $http_upgrade;
      }
  }
  </code></pre>
  
  <p>And my default nginx settings is posted here.</p>
  
  <p><strong>/etc/nginx/nginx.conf</strong></p>
  
  <blockquote>
    <p><a href="http://www.heypasteit.com/clip/OEKIR" rel="nofollow noreferrer">http://www.heypasteit.com/clip/OEKIR</a></p>
  </blockquote>
  
  <p>I have tried adding <code>sendfile_max_chunk 512k</code> and changed <code>worker_processes</code> from 4 to 2. Any other config things were already there. I was not the the one who initially set up the ELK stack.</p>
  
  <p>And after the mentioned changes it looks like this:</p>
  
  <p><strong>/etc/nginx/nginx.conf</strong></p>
  
  <blockquote>
    <p><a href="http://www.heypasteit.com/clip/OEKF0" rel="nofollow noreferrer">http://www.heypasteit.com/clip/OEKF0</a> </p>
  </blockquote>
  
  <p><strong>ERROR RETURNED - DISK SPACE UPDATE</strong></p>
  
  <p>This issue has come back. When I checked the VMs health I noticed that the disk drive was full. Elasticsearch was logging a couple of <code>GBs</code> worth of text in to error logs each day. I still Have not fully identified why elastic search is flooding the error logs.</p>
  
  <p>But I think excessive disk space usage has contributed to this error. Nginx could be detecting this and switching over to minimal safe configuration which would only allow 72kbs of data to be served per file.</p>
  
  <p>When I cleared out the excessive logs i stopped getting the incomplete js error  without needing to restart <code>nginx</code> or <code>kibana</code>.</p>