How to resolve NPM scoped package publish failure that result in error 405

AuthorFullName__c
Matthew Wang
articleNumber
000001019
FirstPublishedDate
2016-09-05T14:54:42Z
lastModifiedDate
2025-05-15

How to resolve NPM scoped package publish failure that result in error 405

You may receive error 405 during NPM deploy if a proxy server decodes slash(/) which is part of npm scope when npm expects to see ASCII representation of slash (%2f).

<In request.log>

When slash is decoded,


20151014140029|21|REQUEST|172.16.183.200|admin|PUT|/api/npm/npm-local/@jfrog/jfrogpkg|HTTP/1.1|405|1540
 

When slash is not decoded


20151014140151|334|REQUEST|127.0.0.1|admin|PUT|/api/npm/npm-local/@jfrog%2fjfrogpkg|HTTP/1.1|201|1545

 

ISSUE/RESOLUTION

Issue: Reverse proxy was decoding slash

Resolution: fix rewrite rule to not decode

  • If in case of Apache, please disable the URL decoding by adding in the conf:-      
  AllowEncodedSlashes NoDecode inside <VirtualHost *:> block
  •  If in case of Nginx, please add the following property to the Nginx:           
 if ( $request_uri ~ ^/artifactory/(.*)$ ) {
                     proxy_pass          http://<rproxy_artifactory>:8081/artifactory/$1;
                    }

 

Reference:

http://stackoverflow.com/questions/20496963/avoid-nginx-decoding-query-parameters-on-proxy-pass-equivalent-to-allowencodeds