Project

General

Profile

[Solved] Serve files without extension as HTML

Added by jonelf 3 months ago

In an older version of Lighttpd I changed

# make the default mime type application/octet-stream.
  ""              =>      "application/octet-stream",

to

# make the default mime type application/octet-stream.
  ""              =>      "text/html",

in the mimetype.assign to make files without a file extension being served as html.
Now I have upgraded to lighttpd/1.4.53 (ssl) and the files are being served as application/octet-stream instead.

I'm running

  Operating System: Raspbian GNU/Linux 10 (buster)
            Kernel: Linux 5.10.103-v7+
      Architecture: arm

How do I serve files without a file extension as html?


Replies (5)

RE: Serve files without extension as HTML - Added by gstrauss 3 months ago

Now I have upgraded to lighttpd/1.4.53 (ssl)

No, you haven't upgraded. Don't delude yourself. lighttpd 1.4.53 was released Jan 2019, almost 5 years ago. The latest stable release of lighttpd is lighttpd 1.4.73, released Oct 2023.

Raspian Oldstable has lighttpd 1.4.59.
Raspian Stable has lighttpd 1.4.69.
Raspian Testing has lighttpd 1.4.73.

I don't know what you think you're "upgrading" to, but please look for a current upgrade path.

How do I serve files without a file extension as html?

The same way as before. Did you read the documentation? mimetype.assign

Did you read the bolded and stickied How to get support - please read at the very top of the Support forum before posting?

Something must have changed between your old config and new config. Again, see How to get support - please read

RE: Serve files without extension as HTML - Added by jonelf 3 months ago

Now I'm running lighttpd/1.4.73 (ssl) - took some tinkering to make it compile.

The same way as before. Did you read the documentation?

Yes, I did.

Here's my current config https://gist.github.com/jonelf/209fb548784a04ef9313e0d3c4c85521

I did copy the mimetypes from the documentation.

Files without file extension are still not served as text/html.

RE: Serve files without extension as HTML - Added by gstrauss 3 months ago

Did you read the bolded and stickied How to get support - please read at the very top of the Support forum before posting?

You did not read all 15 lines of that short post very carefully if you failed to execute the highlighted commands and instead posted your lighttpd.conf with include "/etc/lighttpd/conf-enabled/*.conf"

Make sure you restart lighttpd after modifying the lighttpd configuration and make sure the lighttpd you are running is using the configuration you think it is using.

RE: Serve files without extension as HTML - Added by jonelf 3 months ago

Sorry for not running the commands.

This is very embarrassing. It turns out it was a caching problem in my browser. The config did work.

Sorry for taking up your time!

I believe this thread could be deleted.

RE: Serve files without extension as HTML - Added by gstrauss 3 months ago

Thank you for updating and sharing your solution. It is a good reminder to clear the browser cache.

While this advice is already in the IRC channel topic, I have also added it to How to get support - please read

    (1-5/5)