File-server serving formats like .ply as .txt

1. The problem I’m having:

Im trying to host .ply files on my caddy file server but they get interpreted and served as .txt which breaks some stuff and its annoying if i have to rename them after downloading. the format itself seems to be somewhat text but mostly binary based at least for the data itself.

Is there any way to manually specify that users should be served the raw file or something like that?

2. Error messages and/or full log output:

do i need this?

3. Caddy version:

2.9.1

4. How I installed and ran Caddy:

a. System environment:

Windows 11 24H2 via scoop

b. Command:

cmd /k caddy run --config "C:\Servers\Caddy\caddyfile"

c. Service/unit/compose file:

d. My complete Caddy config:

http://files.atserver.us {
	root * "C:\Servers\File\Public Share"
    file_server {
        browse
    }
}

5. Links to relevant resources:

a file on my server https://files.atserver.us/Mirrors/PlayCanvas/PC%20Public/pc.compressed.ply

example file header

format binary_little_endian 1.0
comment Generated by SuperSplat 2.2.1
element chunk 8419
property float min_x

I found this regarding Caddy version 2. It says that Caddy does not sniff MIME by default, either, for security reasons; if a Content-Type is missing you may need to set the header yourself using the header directive.

I believe the use of this header directive will work:

http://files.atserver.us {
	root * "C:\Servers\File\Public Share"
	header *.ply Content-Type "model/ply"
	file_server {
		browse
	}
}
3 Likes

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