<div dir="ltr">I'm only saying you have way far from the correct configuration, and anything may happen :)<div><br></div><div>LikeĀ <span style="white-space:pre-wrap">try_files $uri $uri</span><span style="white-space:pre-wrap">/</span><span style="white-space:pre-wrap"> </span><span style="white-space:pre-wrap">/</span><span style="white-space:pre-wrap">index</span><span style="white-space:pre-wrap">.</span><span style="white-space:pre-wrap">php$is_args$args</span><span style="white-space:pre-wrap">; alongside proxy_pass. I cannot see how this can work together, or the purpose of it.</span></div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Best regards,<br>Danila</div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Oct 9, 2019 at 9:48 AM Akshay Sulakhe <<a href="mailto:kernelfreak@gmail.com">kernelfreak@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <p>Hi,</p>
    <p>So the only problem you are describing is related to pub/,
      correct? But when I don't use varnish, then these files are
      loading properly... they are found and loaded. The pub/static and
      the path is the one used by magento, not by Varnish. Without
      varnish also the path remains same, and I get the CSS and JS. What
      changes would you recommend? Thank you. :-) <br>
    </p>
    <div>On 09/10/19 4:06 AM, Danila Vershinin
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div id="gmail-m_1854557286030158527geary-body" dir="auto">
        <div>Hi,</div>
        <div><br>
        </div>
        <div>I don't think it's related to Varnish.</div>
        <div><br>
        </div>
        <div>1. You should not be using pub/ in your URLs. The secure
          Magento 2 setup assumes that pub/ directory is your web root,
          so you should end up with URLs without it.</div>
        <div>2. Your CSS/JS is not loaded because they are returning
          404s (thus text/html MIME type, and browser refuses to load
          them because they are not scripts/styles, they are HTML error
          message)</div>
      </div>
      <div id="gmail-m_1854557286030158527geary-quote" dir="auto"><br>
        On Tue, Oct 8, 2019 at 4:17 PM, Akshay Sulakhe
        <a href="mailto:kernelfreak@gmail.com" target="_blank"><kernelfreak@gmail.com></a> wrote:<br>
        <blockquote type="cite">
          
          <p>Hello friends,<br>
          </p>
          <p>I am running magento 2.2.6 on a nginx server. I have
            Varnish installed on another dedicated server. When I use it
            via proxy-pass and contact varnish server first, I am able
            to load the magento website, but CSS and JS are not loading
            due to strict mime-type issue. <br>
          </p>
          <p>Error log :</p>
          <pre><code><span>pub</span><span>/</span><span>static</span><span>/</span><span>version123456</span><span>/</span><span>frontend</span><span>/</span><span>company</span><span>/</span><span>default</span><span>/</span><span>de_DE</span><span>/</span><span>css</span><span>/</span><span>styles</span><span>-</span><span>1.min</span><span>.</span><span>css was blocked due to MIME type </span><span>(</span><span>"text/html"</span><span>)</span><span> mismatch </span><span>(</span><span>X</span><span>-</span><span>Content</span><span>-</span><span>Type</span><span>-</span><span>Options</span><span>:</span><span> nosniff</span><span>)

</span></code></pre>
          <p>We don't have no-sniff added in our Nginx configuration.</p>
          <p>Varnish config :</p>
          <p> default.vcl <br>
          </p>
          <pre><code><span>backend server1c </span><span>{</span><span>
    </span><span>.</span><span>host </span><span>=</span><span> </span><span>"IP1"</span><span>;</span><span>
    </span><span>.</span><span>port </span><span>=</span><span> </span><span>"80"</span><span>;</span><span>       
    </span><span>.</span><span>probe </span><span>=</span><span> </span><span>{</span><span>
          </span><span>.</span><span>url </span><span>=</span><span> </span><span>"/balancer.html"</span><span>;</span><span>
          </span><span>.</span><span>timeout </span><span>=</span><span> </span><span>500s</span><span>;</span><span>
          </span><span>.</span><span>interval </span><span>=</span><span> </span><span>5s</span><span>;</span><span>
          </span><span>.</span><span>window </span><span>=</span><span> </span><span>5</span><span>;</span><span>
          </span><span>.</span><span>threshold </span><span>=</span><span> </span><span>3</span><span>;</span><span>
    </span><span>}</span><span>
</span><span>}</span><span>

backend server1b </span><span>{</span><span>
    </span><span>.</span><span>host </span><span>=</span><span> </span><span>"IP2"</span><span>;</span><span>
    </span><span>.</span><span>port </span><span>=</span><span> </span><span>"80"</span><span>;</span><span>
    </span><span>.</span><span>probe </span><span>=</span><span> </span><span>{</span><span>
          </span><span>.</span><span>url </span><span>=</span><span> </span><span>"/balancer.html"</span><span>;</span><span>
          </span><span>.</span><span>timeout </span><span>=</span><span> </span><span>500s</span><span>;</span><span>
          </span><span>.</span><span>interval </span><span>=</span><span> </span><span>5s</span><span>;</span><span>
          </span><span>.</span><span>window </span><span>=</span><span> </span><span>5</span><span>;</span><span>
          </span><span>.</span><span>threshold </span><span>=</span><span> </span><span>3</span><span>;</span><span>
    </span><span>}</span><span>
</span><span>}</span><span>


backend server1a </span><span>{</span><span>
    </span><span>.</span><span>host </span><span>=</span><span> </span><span>"IP3"</span><span>;</span><span>
    </span><span>.</span><span>port </span><span>=</span><span> </span><span>"80"</span><span>;</span><span>
    </span><span>.</span><span>probe </span><span>=</span><span> </span><span>{</span><span>
          </span><span>.</span><span>url </span><span>=</span><span> </span><span>"/pub/balancer.html"</span><span>;</span><span>
          </span><span>.</span><span>timeout </span><span>=</span><span> </span><span>500s</span><span>;</span><span>
          </span><span>.</span><span>interval </span><span>=</span><span> </span><span>5s</span><span>;</span><span>
          </span><span>.</span><span>window </span><span>=</span><span> </span><span>5</span><span>;</span><span>
          </span><span>.</span><span>threshold </span><span>=</span><span> </span><span>3</span><span>;</span><span>
   </span><span>}</span><span>
</span><span>}</span><span>

</span><span>sub</span><span> vcl_recv </span><span>{</span><span>
    </span><span># Happens before we check if we have this in cache already.</span><span>
    </span><span>#</span><span>
    </span><span># Typically you clean up the request here, removing cookies you don't need,</span><span>
    </span><span># rewriting the request, etc.</span><span>
 </span><span>if</span><span> </span><span>(</span><span>req</span><span>.</span><span>url </span><span>==</span><span> </span><span>"/lazyload/prices/load/"</span><span>)</span><span> </span><span>{</span><span>
        </span><span>return</span><span>(</span><span>pass</span><span>);</span><span>
    </span><span>}</span><span>
    </span><span>if</span><span> </span><span>(</span><span>req</span><span>.</span><span>url </span><span>==</span><span> </span><span>"/roobeo_config/store/changemode/mode/0"</span><span>)</span><span> </span><span>{</span><span>
        </span><span>return</span><span>(</span><span>pass</span><span>);</span><span>
    </span><span>}</span><span>
      </span><span>if</span><span> </span><span>(</span><span>req</span><span>.</span><span>url </span><span>==</span><span> </span><span>"/roobeo_config/store/changemode/mode/1"</span><span>)</span><span> </span><span>{</span><span>
        </span><span>return</span><span>(</span><span>pass</span><span>);</span><span>
    </span><span>}</span><span>
  </span><span>if</span><span> </span><span>(</span><span>req</span><span>.</span><span>url </span><span>==</span><span> </span><span>"/rest/default/V1/carts/mine/estimate-shipping-methods"</span><span>)</span><span> </span><span>{</span><span>
        </span><span>return</span><span>(</span><span>pass</span><span>);</span><span>
    </span><span>}</span><span>
  </span><span>if</span><span> </span><span>(</span><span>req</span><span>.</span><span>url </span><span>==</span><span> </span><span>"/lazywishlist/"</span><span>)</span><span> </span><span>{</span><span>
        </span><span>return</span><span>(</span><span>pass</span><span>);</span><span>
    </span><span>}</span><span>
  </span><span>if</span><span> </span><span>(</span><span>req</span><span>.</span><span>url </span><span>==</span><span> </span><span>"/index.php/rest/V1/"</span><span>)</span><span> </span><span>{</span><span>
        </span><span>return</span><span>(</span><span>pass</span><span>);</span><span>
    </span><span>}</span><span>
  </span><span>if</span><span> </span><span>(</span><span>req</span><span>.</span><span>url </span><span>==</span><span> </span><span>"/customer/account/createpassword/"</span><span>)</span><span> </span><span>{</span><span>
        </span><span>return</span><span>(</span><span>pass</span><span>);</span><span>
    </span><span>}</span><span>
  </span><span>if</span><span> </span><span>(</span><span>req</span><span>.</span><span>url </span><span>==</span><span> </span><span>"/customer/account/resetpasswordpost/"</span><span>)</span><span> </span><span>{</span><span>
        </span><span>return</span><span>(</span><span>pass</span><span>);</span><span>
    </span><span>}</span><span>
  </span><span>if</span><span> </span><span>(</span><span>req</span><span>.</span><span>url </span><span>==</span><span> </span><span>"/roobeo_shipping/zipcode/validate/"</span><span>)</span><span> </span><span>{</span><span>
        </span><span>return</span><span>(</span><span>pass</span><span>);</span><span>
    </span><span>}</span><span>
  </span><span>if</span><span> </span><span>(</span><span>req</span><span>.</span><span>url </span><span>==</span><span> </span><span>"/roobeo_shipping/zipcode/save/"</span><span>)</span><span> </span><span>{</span><span>
        </span><span>return</span><span>(</span><span>pass</span><span>);</span><span>
    </span><span>}</span><span>
  </span><span>if</span><span> </span><span>(</span><span>req</span><span>.</span><span>url </span><span>==</span><span> </span><span>"/roobeo_shipping"</span><span>)</span><span> </span><span>{</span><span>
        </span><span>return</span><span>(</span><span>pass</span><span>);</span><span>
    </span><span>}</span><span>
</span><span>}</span><span>

</span><span>sub</span><span> vcl_init </span><span>{</span><span>
    </span><span>new</span><span> bar </span><span>=</span><span> directors</span><span>.</span><span>round_robin</span><span>();</span><span>
    bar</span><span>.</span><span>add_backend</span><span>(</span><span>server1a</span><span>);</span><span>
    bar</span><span>.</span><span>add_backend</span><span>(</span><span>server1b</span><span>);</span><span>
    bar</span><span>.</span><span>add_backend</span><span>(</span><span>server1c</span><span>);</span><span>
</span><span>}</span></code></pre>
          <p><br>
          </p>
          <p>Nginx config :</p>
          <pre><code><span> location </span><span>/</span><span> </span><span>{</span><span>
        proxy_pass http</span><span>:</span><span>//VARNISH_IP:80;</span><span>
        proxy_set_header </span><span>Host</span><span> $http_host</span><span>;</span><span>
        proxy_set_header X</span><span>-</span><span>Forwarded</span><span>-</span><span>Host</span><span> $http_host</span><span>;</span><span>
        proxy_set_header X</span><span>-</span><span>Real</span><span>-</span><span>IP $remote_addr</span><span>;</span><span>
        proxy_set_header X</span><span>-</span><span>Forwarded</span><span>-</span><span>For</span><span> $proxy_add_x_forwarded_for</span><span>;</span><span>
        proxy_set_header </span><span>Ssl</span><span>-</span><span>Offloaded</span><span> </span><span>"1"</span><span>;</span><span>
        proxy_set_header      X</span><span>-</span><span>Forwarded</span><span>-</span><span>Proto</span><span> https</span><span>;</span><span>
        proxy_set_header      X</span><span>-</span><span>Forwarded</span><span>-</span><span>Port</span><span> </span><span>443</span><span>;</span><span>
        </span><span>#proxy_hide_header X-Varnish;</span><span>
        </span><span>#proxy_hide_header Via;</span><span>
        proxy_set_header X</span><span>-</span><span>Forwarded</span><span>-</span><span>Proto</span><span> $scheme</span><span>;</span><span>
         try_files $uri $uri</span><span>/</span><span> </span><span>/</span><span>index</span><span>.</span><span>php$is_args$args</span><span>;</span><span>
    </span><span>}

Any ideas. Thank you. :-)
</span></code></pre>
          <p><br>
          </p>
          <pre><code><span></span></code></pre>
        </blockquote>
      </div>
    </blockquote>
  </div>

</blockquote></div>