-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
#2544 Allow multiple IP addresses per vhost #1229
#2544 Allow multiple IP addresses per vhost #1229
Conversation
if $port { | ||
$listen_addr_port = "${ip}:${port}" | ||
$nvh_addr_port = "${ip}:${port}" | ||
$listen_addr_port = parseyaml(inline_template('<% res="" %><% @_ip.each { |a_ip| res = res + "#{a_ip}:#{@port}," } %><%= res.split(",").to_yaml -%>')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feels dirty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call this an interesting approach.. @igalic : Would you suggest using a custom function for this? Nevertheless, this could be done a lot easier with future_parser enabled...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll have a real hard time porting this module to 4.x because it's pretty much one of the most used ones out there… i don't really have a strategy there…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@igalic Like @timogoebel said: Do you have another approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this hole line can be broken up into one call to suffix():
$listen_addr_port = suffix($_ip, $port)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks better. But this needs stdlib >= 4.0.0. If the Changelog is right this Requirement will jump from 2.4.x to 4.0.0...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@igalic I've changed that line to suffix(). I've also moved the convertion of nvh_addr_port into an array. It is now in the template. So we nearly don't need any2array() in the vhost.pp
anyway, i think what you really want is… something entirely different: if we're talking about name-based VirtualHosts then:
or are you talking about 2.2 / ip-based virtualhosts? |
bf9c2f7
to
c662f43
Compare
@igalic as far as i see it does not matter if we have ip based or name-based vhosts. Let's say we have a webpage that should be available over IPv4 and IPv6 with vhosts. With the current apache Module we have to make 2 vhosts which just differ in the IP address. A better solution from my point of view is to make one ip based vhost which listens on two ip addresses. So instead of
we have
With name-based vhosts and apache 2.2 we would also need
Apache 2.4 will automatically configure name-based vhosts if there is more than one |
@Benedikt1992 what i don't understand is why you can't just use |
@igalic That works for name-based vhosts. With ip-based vhosts you have to declare every ip address explicitly. Otherwise it wouldn't be a ip-based vhost. |
yes, but you don't need NameVirtualHost for each of those. Please read these two https://httpd.apache.org/docs/2.2/vhosts/name-based.html |
NameVirtualHost is only set if Basically the behaviour has not changed. It is just able to handle an array of IP address/port combinations. |
Is someone still working on this pull request? |
@Benedikt1992 it was a long weekend. |
c662f43
to
a961bd9
Compare
it { is_expected.to contain 'Listen 127.0.0.1:80' } | ||
it { is_expected.to contain 'Listen ::1:80' } | ||
it { is_expected.not_to contain 'NameVirtualHost 127.0.0.1:80' } | ||
it { is_expected.not_to contain 'NameVirtualHost ::1:80' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm still confused about this bit here ^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test case generates an ip-based vhost. Ip-based vhosts don't have a NameVirtualHost
directive. Probably we could delete this two tests scince it is not directly related to the changes. But it is neither false.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what i mean, when we want to use ip-based vhosts, then the namevirtualhost stanzas will create just more confusion. they shouldn't be created at all.
To make a vhost reachable over 2 IP addresses we need to configure 2 similar vhosts which differ in the IP address. This change allows to use an array of IPs.
a961bd9
to
c492b2b
Compare
@Benedikt1992 aside when the nvh issue, could you please squash… also, if you want to have extra magick internet points, you can also change the git commit author to something github recognizes, or else add this email into your github settings. |
…dresses_per_vhost_are_not_possible #2544 Allow multiple IP addresses per vhost
thanks @Benedikt1992! |
@igalic Thank you for merging. It is not possible to change the author afterwards, isn't it? I will keep squashing in my mind |
not in git. (i think you can add it to your profile, and maybe github will be… re-scanning it, adding it to your… magick internet point score) |
To make a vhost reachable over 2 IP addresses we need to configure 2
similar vhosts which differ in the IP address. This change allows to use an array
of IPs.
Ticket: https://tickets.puppetlabs.com/browse/MODULES-2544
Since Release 0.9.0 we have a dependency on stdlib >= 2.4.x CHANGELOG
With the changes in this pull requests we need stdlib >= 4.0.0 since
suffix()
is not available in Release 2.4.x stdlib CHANGELOG, Code