Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sinopsia using a proxy is not working #147

Open
fchambo opened this issue Oct 17, 2014 · 5 comments
Open

Sinopsia using a proxy is not working #147

fchambo opened this issue Oct 17, 2014 · 5 comments

Comments

@fchambo
Copy link
Contributor

fchambo commented Oct 17, 2014

Using nginx as is mentioned in README.md is not working. Various bugs related, I list them by priority:

In the bugs I will use http://mycompany.com/sinopia as the value of url_prefix in config.yaml

  • BLOCKER: when we do npm adduser http://mycompany.com/sinopia, a 'PUT /-/user/org.couchdb.user:neuquino' request is done somewhere. And that url is missing the url_prefix.
  • MAJOR: all static resources use absolute urls like '/-/static/...' or '/-/search...' all those urls are 404 NOT FOUND.

Here I give you some example nginx config I'm using locally to test it:

/etc/nginx/conf.d/default

server {
    listen 43215;
    location ~ /npmjs/?(?<url>.*) {
        proxy_pass http://127.0.0.1:4873/$url;
    }
}

config.yaml

# if you use nginx with custom path, use this to override links
url_prefix: http://localhost:43215/npmjs/

# you can specify listen address (or simply a port)
listen: 0.0.0.0:4873

with this config, I enter Sinopia with this url: http://localhost:43215/npmjs

@rlidwka
Copy link
Owner

rlidwka commented Oct 17, 2014

BLOCKER: when we do npm adduser http://mycompany.com/sinopia, a 'PUT /-/user/org.couchdb.user:neuquino' request is done somewhere. And that url is missing the url_prefix.

I think you meant npm adduser --reg http://mycompany.com/sinopia. This is known to work in npm 1.4, but is probably broken in npm 2.0. If that's so, please report it to https://github.com/npm/npm as a regression.

MAJOR: all static resources use absolute urls like '/-/static/...' or '/-/search...' all those urls are 404 NOT FOUND.

Confirmed, that's a bug here.

@fchambo
Copy link
Contributor Author

fchambo commented Oct 17, 2014

Yes, sorry I meant that.

The versions I used were:

Node 0.10.32

Npm 1.4.28

You can verify it locally with the config I posted above.

@rlidwka
Copy link
Owner

rlidwka commented Oct 18, 2014

You're right, npm 1.4.28 is doing the bad thing as well. Seems like npm makes breaking changes in patches... again...

Try npm 1.4.15, it's the last version that works with this setup.

@fchambo
Copy link
Contributor Author

fchambo commented Oct 19, 2014

The problem is that from npm v1.4.16 it uses npm-registry-client v2.x (instead of v1.x as npm v1.4.15).

The conflicting part is described in npm-registry-client's README:

The registry calls take either a full URL pointing to a resource in the registry, or a base URL for the registry as a whole (for the base URL, any path will be ignored).

I have a workaround modifying nginx config until the npm-registry-client is fixed (I will create an issue in that repository).

/etc/nginx/conf.d/default

server {
    listen 43215;
    location ~ /npmjs/?(?<url>.*) {
        proxy_pass http://127.0.0.1:4873/$url;
    }
    location ~ /(?<url>-/.*) {
        proxy_pass http://127.0.0.1:43215/npmjs/$url;
    }
}

@fchambo
Copy link
Contributor Author

fchambo commented Oct 20, 2014

The MAJOR bug can be fixed merging this pull request.

rmg pushed a commit to strongloop-forks/sinopia that referenced this issue Jun 1, 2017
Added Nexus Repository OSS as similar existing software
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

No branches or pull requests

2 participants