Allow better control over content-type header in response

Created on 9 September 2025, about 1 month ago
Updated 17 September 2025, 24 days ago

Problem/Motivation

Just as for content-type: application/json in No availability to send json response for specific .wellk-nown items. Active you might want your response to be served with content-type: text/plain for certain paths. For example the .well-known/security.txt file should be served with this media type.

Steps to reproduce

1. Create a path with the name security.txt and the value:

# Our security address
Contact: security@example.com
Encryption: https://example.com/pgp-key.txt

2. Visit https://yoursite.com/.well-known/security.txt and inspect the response. The response headers contains:

content-type: text/html; charset=UTF-8

Proposed resolution

Add additional options for the Response type select list. We could add a few that might come in handy in some future scenario.

Proposed options:

  • text/html (this replaces the option "Raw")
  • application/json
  • application/ld+json
  • text/plain

You might even put these options in wellknown.settings.yml under a new variable:

paths: [ ]
response_types:
  -
    label: 'Text/html'
    value: 'text/html'
  -
    label: 'Text/plain'
    value: 'text/plain'
  -
    label: 'Application/json'
    value: 'application/json'
  -
    label: 'Application/ld+json'
    value: 'application/ld+json'
  -
    label: 'Application/xml'
    value: 'application/xml'

This way you could easily add additional response types without opening an issue in this modules issue queue.

Remaining tasks

  1. Decide if options should be hard coded or based on values in wellknown.settings.yml
  2. Review
  3. Merge and tag a new release!

User interface changes

Additional options available in the Response type select element implemented in No availability to send json response for specific .wellk-nown items. Active .

API changes

None.

Data model changes

Potentially new config value in wellknown.settings.yml; response_types. New config value needs to be added to wellknown.schema.yml.

Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

🇸🇪Sweden peter törnstrand

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024