Skip to content

Ability to serve static files for paths different from / #911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
botanegg opened this issue Apr 16, 2025 · 0 comments · May be fixed by #912
Open

Ability to serve static files for paths different from / #911

botanegg opened this issue Apr 16, 2025 · 0 comments · May be fixed by #912

Comments

@botanegg
Copy link
Contributor

botanegg commented Apr 16, 2025

Add a description

For HttpHandlerStatic we cannot serve files for path different from root

Example, for next static_config:

    fs-cache-main:
      dir: /var/www          # Path to the directory with files
      update-period: 10s        # update cache each N seconds
      fs-task-processor: fs-task-processor  # Run it on blocking task processor

    handler-static: # Finally! Static handler.
      fs-cache-component: fs-cache-main
      path: /sub_path/d1/d2/d3/*                  # Registering handlers '/*' find files.
      method: GET              # Handle only GET requests.
      task_processor: main-task-processor  # Run it on CPU bound task processor

For request http://HOSTNAME/sub_path/d1/d2/d3/filename we will seach file /var/www/sub_path/d1/d2/d3/filename instead of intuitive /var/www/filename

It is due to HttpHandlerStatic using request.GetRequestPath() as path to search files in fs-cache:dir
To make possible to work on other base paths, we need to change file search path to GetPathArg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant