question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding headers (e.g. content-disposition) for static resources?

See original GitHub issue

When using static resources documented here: https://www.http4k.org/guide/modules/core/

routes(
    "/static" bind static(Classpath("/org/http4k/some/package/name")),
    "/hotreload" bind static(Directory("path/to/static/dir/goes/here"))
)

Is it possible to somehow define content-type, content-disposition? I tried to add the header manually, but it doesn’t seem trivial.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
knyttlcommented, Jun 12, 2020

Also this might be helpful for adding caching headers for static resources.

1reaction
daviddentoncommented, Jun 11, 2020

We already have a mapping file of extension to content type in mime.types

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set content-disposition to inline for static file(s) in java ...
I know how to set content-disposition header for dynamic requests, but how to set it for static files. Problem is that GAE java...
Read more >
HTTP headers | Content-Disposition - GeeksforGeeks
This response header field holds a number of values and parameters in the larger context of MIME (Multipurpose Internet Mail Extensions).
Read more >
Content-Disposition - HTTP - MDN Web Docs
In a regular HTTP response, the Content-Disposition response header is a header indicating if the content is expected to be displayed inline ...
Read more >
Content-Disposition HTTP Header: Syntax, Directive, Examples
The Content-Disposition HTTP Header response header is a header that indicates whether the content will be displayed inline in the browser.
Read more >
ContentDisposition.Parameters Property (System.Net.Mime)
Examples. The following code example displays the parameters that are sent to the Content-Disposition header.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found