-
Notifications
You must be signed in to change notification settings - Fork 3k
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
VIRTUAL_HOST syntax to support multiple destinations #259
Conversation
Would be useful for me. Google AppEngine SDK dev server exposes 2 ports (8080 and 8000). Would love to be able to have 2 upstreams so they can be routed from this Nginx proxy. Right now I can only expose one or the other. |
@jwilder, what's missing to merge this pull request? It'd be very useful! |
Any update on this issue ? |
@TheBlusky No, it is not solved. |
I'm also needing this feature. @jwilder what's missing for this feature to be integrated? I just took a look on the commits by @bcash-parchment and they look good. What would be the complications? How can I help? |
+1 I'm looking to execute this scenario as well:
Thanks in advance! |
…rc virtual hosts. The syntax is used in the VIRTUAL_HOST env variable. Like this VIRTUAL_HOST=www.example.com=>https:8443,admin.example.com=>https:8444
… get the bats working locally in OS X...1) doesn't support -r argument for xargs 2) after hanging for a long time, existing tests gave me: -- output differs -- expected (1 lines): answer from port 80 90 actual (4 lines): Command "curl --silent --fail http://172.17.0.32:80 90/data" failed 5 times. Status: 7. Output: so obviously there is some other stuff in there that doesn't appear to play nice with OS X :(
FYI...I've rebased this on to the current master branch so it is able to merged by someone with authority ;) ... @jwilder |
Thanks @ammmze , I found i can launch the docker with your template using the procedure of launch in separate containers described in the readme, which allows to specify a custom nginx template file However, to avoid the need of using quotes when setting VIRTUAL_HOST env value for backward compatibility, I changed the separator to "__" from "=>" according to the allowed chars in env variable from this stackoverflow Q/R here |
You might be interested to know there's a docker image containing this PR: ncadou/nginx-proxy. Not guaranteed to be kept up to date though. |
@xloup, It looks to me like that rule only applies to Environment Variable Names, not values. |
@ashleysommer yes you're right, but for info, at least on my config it breaks backwards compatibility in the sense that if quotes were not obligatory in the past, now they will be. and if this pull request is merged, readme needs to be updated with a note that quotes are obligatory in virtualhost="domain.name" syntax |
The quotes should only be required if you use the advanced syntax. You can still use the old syntax without quotes |
Can we have this feature please? @jwilder In my case I would like to use this for gitlab-ce docker image where there is GitLab service and Registry both in one docker image but as separate services with separate internal port and externa url domain. This would really help to setup: VIRTUAL_HOST=gitlab.domain.com=>https:80,registry.domain.com=>https:5000 Or something similiar. I've seen many approaches here. This feature is really wanted 👍 |
Just wanted to say thank you so much for this PR. |
I forked the repo and merged this PR and changed the syntax to '__' instead of '=>' so that it was legal in all env vars. I was hoping someone had done this... now you don't have to go looking for it like I did! No guarantees it will stay updated, but if anyone submits update PRs I will merge it and update docker hub! |
Superseded by #2434 |
This request adds some additional functionality to handling the VIRTUAL_HOST environment variable. So in addition to the default functionality (ie
VIRUTAL_HOST=www.example.com
) you can also do something like this:What this ultimately becomes is 3 upstream configurations (
admin.example.com
,www.example.com
, andother.example.com
).admin.example.com
upstream would route to https://:8444www.example.com
upstream would route to http://:8080other.example.com
upstream would route to https://:8443This is useful for scenarios where you have an application that runs multiple interfaces on different ports. (my current use case is the WSO2 API Manager product, which has an admin interface on one port and client endpoints are on a different port). While in production we would probably run a separate instance for the admin (the other part would still be running idle) and a separate instance for the api endpoints and these would be scaled depending on the load. However, in dev environments, we only want the one container and running separate instances is kind of costly given that the WSO2 products each take about 500MB ram to run idle.