sonatype / nexus-public

Sonatype Nexus Repository Open-source codebase mirror
https://www.sonatype.com/products/repository-oss-download
Eclipse Public License 1.0
1.84k stars 557 forks source link

repository raw(proxy) doesn't cache json content #344

Open peedy2495 opened 4 months ago

peedy2495 commented 4 months ago

Intention

I have to cache content from api.github.com for parsing json items in ansible deployments.

Environment

Docker-Image sonatype/nexus3:3.65.0

Reproduction

example task:

- name: kubernetes - install k9s - determine latest tag @GitHub
  uri:
    url: http://ubuntu-proxy:8081/repository/raw-api.github/repos/derailed/k9s/releases/latest
    return_content: true
    headers:
      Content-Type: "Accept: application/vnd.github+json"
    body_format: json
  register: k9s_latest

the content is stored as k9s_latest.stdout, only

using the original url it's working like a charm: https://api.github.com/repos/derailed/k9s/releases/latest

same reproduction with curl:

curl -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" http://192.168.123.180:8081/repository/raw-api.github/repos/derailed/k9s/releases/latest|less ... returns a textblock.

curl -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/derailed/k9s/releases/latest|less returns clean json ...

Using the standard header "Accept: application/json", only: all previous described methods causing the same results

Examining the content in nexus tells "Content Type : text/plain"

Expected behavior:

Nexus provides correct content types on calling types via header.