302-redirect: SVG-Images with Mime-Type: text/plain | Nginx and Cloudflare Setting

First some stats about my current setup:

  • I am running a blog based on ghost which can be found via bitcoin-2go.de
  • The blog is hosted on an nginx-server with digitalocean
  • I am using Cloudflare as a CDN

While testing my site with the Google Chrome Dev-Tools, I have been facing the following issue:

The main page contains several images whereas some are served as .svg . I have configured the /etc/nginx/nginx.conf and included the following code-snippet:

    http {
           include /etc/nginx/mime.types;
          }

I have also made sure that /etc/nginx/mime.types contains the following line

image/svg+xml svg svgz;

As expected, .svg files are rendered perfectly. However, for the first four images on the website are served with content-type: text/plain; charset=utf-8 . In addition, they create a 302-redirect pointing to the original source. Images are defined following this pattern:

<img srcset="{{img_url feature_image size="s"}} 400w,
             {{img_url feature_image size="m"}} 600w, 
             {{img_url feature_image size="l"}} 800w,
             {{img_url feature_image size="xl"}} 1200w"
     sizes="(max-width:480px) 350px, 500px"
     src="{{img_url feature_image size="m"}}"
     loading="lazy"
     alt="{{title}}">

As the attached screenshot shows the four 302-redirect create additional requests (obviously) and slow down the pagespeed significantly.

Waterfall Diagramm for loaded assets

I’d appreciate any kind of help that would explain me why the first four .svg-images are served with content-type: text/plain and how I can get rid of it.