Artifactory fully supports npm scope packages. The support is transparent to the user and does not require any different usage of the npm client.
Npm 'slash' character encoding
By default, the npm client encodes slash characters (/
) to their ASCII representation (%2f
) before communicating with the npm registry. If you are running Tomcat as your HTTP container (the default for Artifactory), this generates an HTTP 400 error since Tomcat does not allow encoded slashes by default. In order to work with npm scoped packages, you can override this default behavior by defining the following property in the catalina.properties
file of your Tomcat:
org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true
You can also add -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH: true to the Artifactory System YAML under the extraJavaOpts
section. The bundled Tomcat is configured by default to enable encoded slashes.
URL decoding and reverse proxy
If Artifactory is running behind a reverse proxy, make sure to disable URL decoding on the proxy itself to work with npm scope packages.
For Apache, add the following setting inside the <VirtualHost *:xxx>
block:
AllowEncodedSlashes on directive