Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Using Nexus npm proxy results in invalid http responses #26

Open
ThYpHo0n opened this issue May 15, 2020 · 4 comments
Open

Using Nexus npm proxy results in invalid http responses #26

ThYpHo0n opened this issue May 15, 2020 · 4 comments

Comments

@ThYpHo0n
Copy link

I tried using nexus-proxy in the context of the oteemo helm chart (https://github.com/Oteemo/charts/tree/master/charts/sonatype-nexus)
and it resulted in the issue that during npm installs I get invalid http responses:
ERROR  request to https://nexus.company.com/repository/npm-public/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz failed, reason: Parse Error: Content-Length can't be present with chunked encoding

My helm chart values to reproduce:

...
ingress:
  enabled: true
  path: /*
  annotations:
    kubernetes.io/ingress.class: gce
    kubernetes.io/ingress.global-static-ip-name: my-static-ip
  tls:
    enabled: true
    secretName: wildcard-cert
nexusProxy:
  env:
    nexusHttpHost: nexus.company.com
    nexusDockerHost: containers.company.com
    enforceHttps: true
...

Other proxy repos like maven are working fine though and also the webinterface of Nexus is working as expected, therefore I think it has to be something specific to the npm proxy repository.

@varditn
Copy link
Contributor

varditn commented May 20, 2020

Hi @ThYpHo0n we didn't encounter this issue since we are not using Nexus for npm supported artefacts. If you have any solution for the issue you are seeing, please feel free to supply a PR and we will test and merge it.

@GermainFCMS
Copy link

GermainFCMS commented Mar 30, 2021

Hello there. I actually encountered same problem when using npm repo, and used npm commands to download artifacts.
Problem occurs when client use http1.1 only (not with http1.0 et and http2).
Because npm CLI use http1.1, this issue is quite blocking.

you can reproduce it by curl with this :

curl -i 'http://my-nexus-Reop/repository/whatever-hosted/whatever-artifact.tgz' --http1.1

You will see in http response headers :

Last-Modified: Mon, 29 Mar 2021 15:27:42 GMT Content-Type: application/x-tgz Content-Length: 158099 Transfer-Encoding: chunked
=> in http1.1 spec, it is not allowed to have at the same time Content-Length and Transfer-Encoding: chunked
headers (cf https://stackoverflow.com/questions/3304126/chunked-encoding-and-content-length-header/3304186 and https://greenbytes.de/tech/webdav/rfc2616.html#rfc.section.4.4)

I fixed that in PR #29. Can you consider it ?

@y0u3uf
Copy link

y0u3uf commented Jun 14, 2021

facing same issue. what was the way forward?

@dotandimet
Copy link

This is a duplicate of issue #20. It effects both npm and pypi registries, with the difference that pip treats the mix of Content-Length and Transfer-Encoding: Chunked as a warning while npm exits with an error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants