Main Stylesheet MIME Type is converted when website is published on AppEngine

Hi everyone,

On my static site, when I run “hugo server” locally, my main CSS stylesheet file (domain.com/scss/style.min.css) is well available with the right MIME Type (text/css).

When I publish this Website on Google AppEngine, with exactly the same code, my file is still available but the MIME Type is modified to “application/octet-stream”, which causes the CSS not loading at all…

Here is the code on my “head.html” file where the Main Stylesheet is defined:

{{ "<!-- Main Stylesheet -->" | safeHTML }}
{{ $styles := resources.Get "scss/style.scss" | toCSS | minify }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen">

Here is the code of the “app.yaml” file to make the site available (nothing really special here):

runtime: python37

instance_class: F1

handlers:

## static content routing
- url: /
static_files: src/public/index.html
upload: src/public/*
secure: always

# hugo generates pages in directories so check for index.html first
- url: /(.*)/
static_files: src/public/\1/index.html
upload: src/public/*
secure: always

- url: /
static_dir: src/public/
secure: always

error_handlers:
- file: default_error.html

Is someone can help me, I’m stuck for many hours now and I don’t find any way to solve my problem…

Thanks :slight_smile:

Have you asked that hosting company for help? It sounds likes it’s their service changing the mime type.

After quickly going through App Engine app.yaml reference  |  App Engine standard environment for PHP 5  |  Google Cloud it seems like App Engine serves content by handlers.

Try put styles under different route (like /styles or /assets).

Maybe this will help.

Hey !

Thanks for your suggestions, I found the solution and the problem was related to the provider.

I don’t know why but GCP was re-writing the mime type of my CSS file and I had to force the CSS mime type in my app.yaml file like this:

## static content routing
- url: /scss
static_dir: www/public/scss
mime_type: text/css
secure: always
redirect_http_response_code: 301

This topic can be closed.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.