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

nginx, scope, and relative paths that reverse proxy to sinopia #380

Open
MystK opened this issue Mar 6, 2016 · 2 comments
Open

nginx, scope, and relative paths that reverse proxy to sinopia #380

MystK opened this issue Mar 6, 2016 · 2 comments

Comments

@MystK
Copy link

MystK commented Mar 6, 2016

I spent a whole day on this and I'd like to share what I did so when others search here, they find a solution. I'm not sure if this the best possible place, so please direct me to the correct place if not. :)

Scenario:
You want to use nginx, scopes(@Company), and relative path (https://companydomain.com/sinopia) to sinopia.

What you have to do is smartly edit your nginx.conf

  location /sinopia/ {
    if ($request_uri ~* "^/sinopia(.*)$") {
      proxy_pass              http://127.0.0.1:4873$1;
    }
    proxy_pass              http://127.0.0.1:4873/;
  }

The if statement doesn't rewrite your "%2f" into a "/". You need this because you want to pass your packages as @scope%2fPACKAGENAME.

@RnbWd
Copy link

RnbWd commented Mar 8, 2016

Definitely more complex than what I had to do getting it to work with a general purpose proxy a year ago - haven't seen this solution before, but it's like the 3 or 4 time I've seen these issues posted (nginx proxy / scoped variables). Thankfully nothing has require more than 2 or 3 lines of code (although it's tricky). I wish there was like a wiki or something posted on the Readme at least to let people know how to work around the proxies the scoped variables - I was able to do it a year ago by changing small part of the express app and the config.yml, but anyways thanks for sharing this - it bypasses having to modify the source and fork this library

nm separate issue

@RnbWd
Copy link

RnbWd commented Mar 20, 2016

thx - just ran into this issue

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

3 participants
@RnbWd @MystK and others