racket / racket/web-server

misconfigured `servlet-root` leads to confusing state

Open
#141 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
99
Forks
48
PR merge metrics
No merged PRs in 30d

Description

I am trying to move an old use of the web server (from version 3.99 approx) to the new web server library and it has a configuration table that gets used via configuration-table->sexpr. In that configuration, file-root is set to "htdocs" and servlet-root is set to ".", but in the actual file system, the servlets are in the directory that contains "htdocs". That is, the correct configuration should have been setting servlet-root to ".." (or moving the servlets I suppose).

The problem, however, is that this configuration did not result an a sensible error message or even any error message. Instead, what happens is that an attempt to run the servlets results in a web page that says “The file you were looking for was not found on this server.”. This seems to be happening because there are some error-swallowing handlers that are pretty misleading. The real troublesome one seems to be the one in this loop that causes the web server to iterate through all of the path components of the url and eventually terminate due to this error.

I'm not sure of the best approach to dealing with this, but some thought towards a better response from the webserver to a similar kind of misconfiguration would be much appreciated. It doesn't have to be anything particularly sophisticated but tracing through what happened in the code to understand my misconfiguration was not a nice experience! 😅

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Reproduce the configuration using file-root "htdocs" and servlet-root ".", then trace the filesystem-map.rkt loop around the reported line and the linked Racket issue 5488. Determine where the misconfiguration is swallowed, and consider how the web server can provide a clear response instead of the generic file-not-found page.

Written by the indexing model from the issue text.

Assessment

Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.