nixcloud/nixcloud-webservices

darkhttpd static webserver by design needs external mimetype indication

Closed this issue · 2 comments

I've tested the nixcloud abstractions for static hosting, and the current darkhttpd back-end seems to not be able to properly serve SVG files with their mimetype (design decision of the author of darkhttpd). Some browser then refuse to show these, which would result in brokenness.

In the pull request I made before (#2), this was covered by reusing the apache mime.types. There were a number of other useful options to tweak the behaviour of darkhttpd. In the setup I suggested as well - including turning directory listing off, location of logs, etc. This allowed for convenient user customisation while keeping the service definition fully generic. In fact, there was not much specific to darkhttpd at all.

  • serviceCommand = "${pkgs.${config.serviceName}}/bin/${serviceName}";
  • serviceParameters = [
  •  "${toString config.staticDir}"
    
  •  "--addr" "127.0.0.1"
    
  •  "--port" "${toString config.proxyOptions.port}"
    
  •  "--no-server-id"
    
  •  "--daemon"
    
  •  "--no-keepalive"
    
  •  "--mimetypes" "${pkgs.apacheHttpd}/conf/mime.types"
    
  • ] ++ optional (!config.directoryListing) "--no-listing"
  •  ++ optional (config.log) "--log ${config.logFile}";
    

yes, valid ideas. do you want to do a PR or shall i try to fix it?

fixed in 48b3a82