Skip to content

fix: set correct Content-Type for Prometheus metrics endpoint#107

Open
opyh wants to merge 1 commit intomainfrom
fix/prometheus-metrics-content-type
Open

fix: set correct Content-Type for Prometheus metrics endpoint#107
opyh wants to merge 1 commit intomainfrom
fix/prometheus-metrics-content-type

Conversation

@opyh
Copy link
Copy Markdown
Member

@opyh opyh commented Feb 11, 2026

🖊️ Description

💡 What? Why? How?

Fixed the Prometheus metrics endpoint returning incorrect Content-Type: text/html header, which caused Prometheus scrapes to fail with:

received unsupported Content-Type "text/html" and no fallback_scrape_protocol specified for target

Changes:

  1. Added explicit Content-Type: text/plain; version=0.0.4; charset=utf-8 header (Prometheus standard)
  2. Fixed typo in join delimiter: "/n""\n" (forward slash vs backslash)
  3. Updated OpenAPI spec to declare text/plain instead of application/json

Root cause: Nitro.js defaults to text/html when no Content-Type header is explicitly set.

📎 Related Ticket

Fixes TargetDown alert for a11yscore-metrics in production monitoring.

⚠️ Creation checklist

  • The automated tests are passing.
  • My code is self-documenting
  • The commit messages follow conventional commits standard

🔬 Testing instructions

After deployment, verify:

  1. curl -u prometheus:$PASSWORD https://a11yscore.wheelmap.tech/a11yscore/v1/auth/metrics/prometheus -I returns Content-Type: text/plain; version=0.0.4; charset=utf-8
  2. Prometheus targets show a11yscore-bullmq as healthy in the monitoring namespace

- Add Content-Type header: text/plain; version=0.0.4; charset=utf-8
- Fix typo: "/n" → "\n" in join delimiter
- Update OpenAPI spec to declare text/plain response

Prometheus scrapes were failing with "received unsupported Content-Type
text/html" because Nitro.js defaults to text/html when no Content-Type
is set.
@opyh opyh requested a review from a team as a code owner February 11, 2026 03:40
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 this pull request may close these issues.

1 participant