[FEAT] Default site returns 200 for unknown paths, so nginx-botsearch never matches

Open Beginner friendly
#631 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
docker, nginx
Domain
devops, security

Research direction

Start by locating the sample default.conf and inspect its try_files directive. Check how the default site serves / and whether the proposed =404 fallback preserves that behavior. Done when unknown paths return 404 while / still serves the landing page; the issue does not name a test, so verify both cases against the sample configuration.

Written by the indexing model from the issue text.

Description

Is this a new feature request?
  • I have searched the existing issues
Wanted change

Hi,

the default site should return 404 for paths that don't exist. Right now it falls back to /index.html and returns 200 for everything.

Reason for change

I wondered why fail2ban never banned the scanners hitting my server. The nginx-botsearch jail only matches requests with a 404:

failregex = ^<HOST> \- \S+ \[\] \"(GET|POST|HEAD) \/<block> \S+\" 404 .+$

But the default site has

try_files $uri $uri/ /index.html /index.htm /index.php$is_args$args;

so every unknown path gets the landing page with 200:

"GET /.ssh/id_rsa HTTP/1.1" 200 1345 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
"GET /%2egitconfig HTTP/2.0" 200 1345 "-" "curl/8.7.1"

In my access log that happened 5282 times, and the jail matched only 21 of 373440 lines. My default.conf is the unchanged sample (2026/03/07).

Proposed code change
try_files $uri $uri/ =404;

/ still shows the index.html. If the fallback is there on purpose (php apps in /config/www), maybe add a comment in the sample that nginx-botsearch doesn't work for the default site then.

Dominant language
Dockerfile
Stars
3.8k
Forks
276
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from linuxserver/docker-swag

All issues in linuxserver/docker-swag

Similar issues

More DevOps issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.