Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

301
Views
Serving static resources with Micronaut, with directory hierarchy

Given the following configuration in application.yml, I would expect to be able to serve files from both of the following paths:

  • http://localhost/static/image.png (from /root/static/image.png)
  • http://localhost/static/folder/image.png (from /root/static/folder/image.png)

However, only the first path works. The second returns a 200 status code with the following in the response body: {"message":"Page Not Found","_links":{"self":{"href":"/static/folder/image.png","templated":false}}}

The issue seems to be the extra subdirectory, but I would have expected the **/* in the mapping field to allow for subdirectories. FWIW, I get the same error if I request a resource that does not exist.

This is on Micronaut 2.

micronaut:
  application:
    name: api
  router:
    static-resources:
      default:
        paths: file:/root/static
        mapping: /static/**/*
        enabled: true

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The paths key should be a list (as hinted by the plural):

  router:
    static-resources:
      default:
        paths: 
          - file:/root/static
        mapping: /static/**/*
        enabled: true
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!