Hugo

Using Hugo Pipes for CSS Minification Fails to Load on Proxy Servers

Curious if this is a known issue / quirk of proxy servers, but any site I run through hugo pipes for minification and fingerprinting will not properly load the CSS on [most] proxy servers. I uncovered this recently trying to troubleshoot what ended up being a strange local cache issue, but I was wondering if anyone had any insight into why this would be? Is it the additional extension added to the filename possibly? The CSS loads fine with no minification / fingerprinting run on all proxy servers.

Secondly, is this something I should even worry about? It seems to load fine on any other device and browser.

Thank you for any help or insight!

1 Like

I’m interested in learning more about how those interact with Hugo, if anyone has experience.

Say, could you share more into about the setups you use? Which kinds of proxies? I ask because this didn’t occur to me, and I’m wondering if some projects aren’t rendering correctly and I missed it.

So, there may be speficic issues with minificationg doing the wrong thing, but I fail to see how it could relate to proxy server.

Thanks for the questions! I’m not sure what could be wrong with the minification, it loads fine on every device i’ve personally tested and many of these sites have been live and functioning for some time now until I came across this issue. It happens when I minify and fingerprint CSS or SASS files run through hugo pipes like this:

{{ $style := resources.Get "css/style.css" | minify | fingerprint }}

<link   rel="stylesheet"
        href="{{ $style.Permalink }}"
        integrity="{{ $style.Data.Integrity }}"
        media="screen">

or

{{ $sass := resources.Get "css/style.scss" }}
{{ $style := $sass | resources.ToCSS | minify | fingerprint }}

<link   rel="stylesheet"
        href="{{ $style.Permalink }}"
        integrity="{{ $style.Data.Integrity }}"
        media="screen">

You can see a site minified here: aggieadvocates.com

using most proxies it will render as if the CSS isn’t loading: https://www.hidemyass.com/en-us/proxy

but this proxy server is one of the few that still seems to render the page fine: kproxy[dot]com

compared to this project I did, without any minification, works fine on all proxies… bastropcountryclub[dot]com

(sorry for the [dot] links - I can only post two links as a new user)

I’ve narrowed down the issue to the Fingerprinting / Integrity. The majority of these proxy providers seem to not like something about that. I’m not well-enough versed to answer why, but removing the integrity fixed it across the board - Minification still in use.

Suffice to say I’d still like to know if anyone knows more about the extent of this “issue” (I struggle to even call it that because I tested on ever ‘modern’ browser back to IE8 and wasn’t able to reproduce this issue outside of the proxy servers. But I also dont know if this would theoretically affect people using a VPN also then?

I was also able to confirm the integrity / fingerprinting can prevent the file from being properly loaded when using netlify branch subdomains. So it’s so to be something with the additional hashing on the file names.

How are you confirming? Are you comparing the hashes?

Tried the same code with and without integrity on the production branch (deployed to the root domain) and on a netlify brand subdomain (which uses the $deploy-prime-url) to add the staging link.

Works fine on production, but on staging the link isn’t loading- the hashes are the same, so that’s not the issue.

I’m not sure if these are related to the proxy failing to load, but I feel like it might be.

I can’t help, I don’t use half the things you are proposing creates an issue. Here’s some observations, though:

  1. “Proxy” is a concept, not a standard. It makes sense some proxies will fail to load a fingerprinted resource; some might say that is by design.
  2. If you are having an issue with a Netlify sub-domain, you ought to contact them; they’d want to know if fingerprinting wasn’t working correctly.
  3. Without your code repo, no one can reproduce this error (or no one else has noticed); I suggest you make it easy for another helper to reproduce your error. :slight_smile:

Ganbatte!

1 Like