Code Monkey home page Code Monkey logo

Comments (15)

thaJeztah avatar thaJeztah commented on May 21, 2024

@andrefernandes could you re-format your example, because it's quite hard to read right now. You can either indent the whole block with 4 spaces or put three back-ticks before and after the example.

from nginx-proxy.

andrefernandes avatar andrefernandes commented on May 21, 2024

Sorry for that, it was like 2 AM... Fixed.

from nginx-proxy.

jwilder avatar jwilder commented on May 21, 2024

Can you elaborate on why just VIRTUAL_HOSTs does not work? Each container can have multiple virtual hosts defined as well.

from nginx-proxy.

andrefernandes avatar andrefernandes commented on May 21, 2024

Not much of a big deal.

The DNS guys around here cannot create new DNS entries on an acceptable timeframe, while paths are under my control.

Actually I prefer VIRTUAL_HOSTs too.

De: Jason Wilder [mailto:[email protected]]
Enviada em: sexta-feira, 19 de setembro de 2014 14:04
Para: jwilder/nginx-proxy
Cc: Andre de Oliveira Fernandes
Assunto: Re: [nginx-proxy] Another template for VIRTUAL_PATHs instead of VIRTUAL_HOSTs (#33)

Can you elaborate on why just VIRTUAL_HOSTs does not work? Each container can have multiple virtual hosts defined as well.


Reply to this email directly or view it on GitHubhttps://github.com//issues/33#issuecomment-56205256.

from nginx-proxy.

hbredin avatar hbredin commented on May 21, 2024

+1 for this kind of functionality.

BTW @andrefernandes, in current state of the nginx.tmpl template, not providing a VIRTUAL_PATH would result in the following line

location /<no value>

while (I think) it should be

location /

An even more user-friendly template could allow something like

docker run -e VIRTUAL_URL=www.example.com/path ...

and automatically derive VIRTUAL_HOST and VIRTUAL_PATH from this VIRTUAL_URL variable.
If that is of interest, I am willing to help though I am not sure I understand how the whole thing works.

from nginx-proxy.

trinitronx avatar trinitronx commented on May 21, 2024

For anyone running this in front of a docker registry container...

Now that the docker registry v2.0 is out, and they've pretty much done away with /v1/ API backwards compatibility, this feature / use case is definitely needed ;-)

They're currently recommending to run a v1 and v2 registry in parallel with an nginx proxy in front. Their nginx config just passes the requests for /v1/ and /v2/ to the different backend containers.

from nginx-proxy.

md5 avatar md5 commented on May 21, 2024

Getting this working for the /v1 v. /v2 case is pretty easy and already works in [https://github.com/jwilder/nginx-proxy/compare/master...appropriate:multiple-paths](my multiple-paths branch). Getting it working in such a way that it's mergeable in the general case is quite a bit harder. The underlying docker-gen utility would have to include a sort* command that could do a reverse sort by longest path segments. There would also have to be a provision for providing a sane (and secure) response for / if no backing container provided a VIRTUAL_PATH=/.

from nginx-proxy.

PavelVanecek avatar PavelVanecek commented on May 21, 2024

Because of reasons, github points md5's link above to incorrect address. The actual link is: master...appropriate:multiple-paths

from nginx-proxy.

md5 avatar md5 commented on May 21, 2024

I just took a look at the Nginx docs and found that location matches don't actually happen in the order they're defined. Nginx already does a "longest prefix" algorithm:

To find location matching a given request, nginx first checks locations defined using the prefix strings (prefix locations). Among them, the location with the longest matching prefix is selected and remembered. Then regular expressions are checked, in the order of their appearance in the configuration file. The search of regular expressions terminates on the first match, and the corresponding configuration is used. If no match with a regular expression is found then the configuration of the prefix location remembered earlier is used.

So I think the only thing that actually needs to be fixed to make my multiple-paths branch usable is to make sure that a 503 error is returned for / when no location matches it.

from nginx-proxy.

lonix avatar lonix commented on May 21, 2024

I Would love this feature.

from nginx-proxy.

md5 avatar md5 commented on May 21, 2024

I just took a look at getting my master...appropriate:multiple-paths branch back in shape and it's turning out to be quite painful...

There have been quite a few changes in nginx.tmpl since I last updated the branch and the logic in the template is getting more and more complicated. It will only get more complicated if I add this or if some of the open feature requests get implemented (e.g. making the HTTP to HTTPS redirect conditional).

Trying to do a direct rebase seems to be more trouble than it's worth. I think the only viable approach is to reproduce the VIRTUAL_PATH changes from scratch.

from nginx-proxy.

md5 avatar md5 commented on May 21, 2024

I guess I spoke too soon. I managed to get the branch closer to a mergeable state, though it still doesn't handle the 503 issue I mentioned in my comment from July: #33 (comment)

Before doing any more work on that branch, I'd like to see #244 merged. I think it still needs to have the additional lines fixed that are mentioned in this comment: #244 (comment)

I'd also like to see the whitespace in the file made consistent again, but that's not a huge deal.

from nginx-proxy.

md5 avatar md5 commented on May 21, 2024

I finally opened what I think is a mergeable PR for this feature over at #254

Please discuss the patch I've offered at that PR if you're interested in this feature.

from nginx-proxy.

andrefernandes avatar andrefernandes commented on May 21, 2024

Sure!

De: Mike Dillon [mailto:[email protected]]
Enviada em: sexta-feira, 9 de outubro de 2015 00:50
Para: jwilder/nginx-proxy [email protected]
Cc: Andre de Oliveira Fernandes [email protected]
Assunto: Re: [nginx-proxy] Another template for VIRTUAL_PATHs instead of VIRTUAL_HOSTs (#33)

I finally opened what I think is a mergeable PR for this feature over at #254#254

Please discuss the patch I've offered at that PR if you're interested in this feature.


Reply to this email directly or view it on GitHubhttps://github.com//issues/33#issuecomment-146748495.

from nginx-proxy.

buchdag avatar buchdag commented on May 21, 2024

This features has been added to the dev branch with #1607

It's available now on the dev images nginxproxy/nginx-proxy:dev and nginxproxy/nginx-proxy:dev-alpine. Testing and feedback are welcome, the docs for the feature is here and there is another PR opened for additional improvements and comments.

from nginx-proxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.