0

I use DDEV v1.15.3 with Typo3 v9 environment. I created the Typo3 environment according to the Quick Guide with ddev config --project-type=typo3 --php-version 7.3 --docroot=public --create-docroot=true. So far everything works fine, but no SVGZ files are displayed.

A svgz file uploaded in the backend in the fileadmin is not displayed in the browser - like https://ddev-typo3v9.ddev.site:444/fileadmin/user_upload/meinen_jmd_vor_ort_finden.svgz. I get the following error message:

This page contains the following errors: error on line 1 at column 1: Encoding error Below is a rendering of the page up to the first error.

To enable compression with gzip in the nginx-container, I added the following lines to the file .ddev/nginx_full/nginx-site.conf

# Compression
gzip on;
gzip_proxied        any;
gzip_comp_level     6; # Level of compression
gzip_http_version   1.1;
gzip_min_length     1100;
gzip_buffers        16 8k;

gzip_types
 text/plain
 text/css
 text/xml
 application/x-javascript
 application/atom+xml
 text/mathml
 text/vnd.sun.j2me.app-descriptor
 text/vnd.wap.wml
 text/x-component
 text/javascript
 application/javascript
 application/json
 application/xml
 application/rss+xml
 font/truetype
 font/opentype
 application/vnd.ms-fontobject
 image/svg+xml svg svgz;

gzip_static on;
gunzip on;
gzip_proxied        expired no-cache no-store private auth;
gzip_disable        "MSIE [1-6] \."; # Disable for IE < 6

# Add a vary header for downstream proxies to avoid sending
# cached gzipped files to IE6
gzip_vary on;

# ### Compression ###

# For CSS with compression
location ~* "\.css(\.|\.\d{10}\.)gzip$" {
        rewrite ^(.+css)\.(\d+\.)gzip$ /$1.gzip;
        add_header  Content-Encoding gzip;
        add_header  Vary Accept-Encoding;
        add_header Access-Control-Allow-Origin *;
        gzip off;
        types { text/css gzip; }
        expires max;
        log_not_found off;
}

# For JavaScript with compression
location ~* "\.js(\.|\.\d{10}\.)gzip$" {
        rewrite ^(.+js)\.(\d+\.)gzip$ /$1.gzip;
        add_header  Content-Encoding gzip;
        add_header  Vary Accept-Encoding;
        gzip off;
        default_type application/javascript;
        expires max;
        log_not_found off;
}

# Compression for SVGZ
location ~* \.svgz$ {
       add_header Content-Encoding gzip;
}

When I use ddev ssh to connect to the docker container, the nginx configuration also contains the above lines.

Thanks for your help.

Best greetings

-- Gerald

rfay
  • 9,963
  • 1
  • 47
  • 89

1 Answers1

0

What you need in .ddev/nginx_full/nginx-site.conf is adding

location ~ \.svgz$ { add_header Content-Encoding gzip; }

I put my nginx-site.conf file at https://gist.github.com/rfay/5071ff19237ee7b83442cd8ad0311459

I used the file example.svgz from https://www.online-convert.com/file-format/svgz

This nginx issue explained what to do.

Here's what I see after 1) Uploading example.svgz with the file manager and then 2) Clicking the "show" icon.

enter image description here

If you think this is important to add to the default nginx configurations, please open an issue or a PR at https://github.com/drud/ddev/issues

rfay
  • 9,963
  • 1
  • 47
  • 89