-
Notifications
You must be signed in to change notification settings - Fork 647
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
Make nginx support multiple servers entries #868
Conversation
Currently the code [::]:80 ipv6only=off does not supported when running multiple servers in nginx.conf More details in https://unix.stackexchange.com/questions/321879/remove-ipv6only-option-from-puppet-nginx-module https://serverfault.com/questions/638367/do-you-need-separate-ipv4-and-ipv6-listen-directives-in-nginx http://nginx.org/en/docs/http/ngx_http_core_module.html#listen https://forum.opnsense.org/index.php?topic=8877.msg44610#msg44610 This fix works as expected.
|
There is also a file for the web interface which is currently not included which includes this listen directives as well. |
|
Hi @fabianfrz , if the file is wegbui.conf, it seems the listen directive is OK. There are no problem with it. |
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.
needs some adjustments
| @@ -87,7 +87,7 @@ location {{ location.matchtype }} {{ location.urlpattern }} { | |||
| {% if location.upstream is defined and (location.php_enable is not defined or location.php_enable != '1') %} | |||
| {% set upstream = helpers.getUUID(location.upstream) %} | |||
| proxy_set_header Host $host; | |||
| proxy_pass http{% if upstream.tls_enable == '1' %}s{% endif %}://upstream{{ location.upstream.replace('-','') }}; | |||
| proxy_pass http{% if upstream.tls_enable == '1' %}s{% endif %}://upstream{{ location.upstream.replace('-','') }}{% if location.new_urlpattern != '' %}{{ location.new_urlpattern }};{% endif %} | |||
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 will throw a NPE because it may not be set. Guard with an is defined check first
| @@ -205,6 +205,9 @@ | |||
| <Required>N</Required> | |||
| <multiple>N</multiple> | |||
| </upstream> | |||
| <new_urlpattern type="TextField"> | |||
| <Required>N</Required> | |||
| </new_urlpattern> | |||
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.
the name suggest something different - how about path_prefix?
| <id>location.new_urlpattern</id> | ||
| <label>New location path</label> | ||
| <type>text</type> | ||
| <help>Select a new path for upstream to proxy.</help> |
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 is a textbox, you cannot select. Enter or Define would be a lot better. Also explain what is doing.
| @@ -205,6 +205,9 @@ | |||
| <Required>N</Required> | |||
| <multiple>N</multiple> | |||
| </upstream> | |||
| <new_urlpattern type="TextField"> | |||
| <Required>N</Required> | |||
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.
needs a mask regex pattern - usually no whitespace allowed which is \S+, maybe you also want to limit the length to something useful by using {,100} for a maximum length of 100 instead of +.
| @@ -61,6 +61,12 @@ | |||
| <style>selectpicker</style> | |||
| <help>Select an upstream to proxy to or connect via FastCGI if chosen.</help> | |||
| </field> | |||
| <field> | |||
| <id>location.new_urlpattern</id> | |||
| <label>New location path</label> | |||
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.
see other comments
|
@fabianfrz thanks by your comments, I will split it into two pull requests and make the changes as you suggest |
Currently the code [::]:80 ipv6only=off does not supported when running multiple servers in nginx.conf
More details in
https://unix.stackexchange.com/questions/321879/remove-ipv6only-option-from-puppet-nginx-module
https://serverfault.com/questions/638367/do-you-need-separate-ipv4-and-ipv6-listen-directives-in-nginx
http://nginx.org/en/docs/http/ngx_http_core_module.html#listen
https://forum.opnsense.org/index.php?topic=8877.msg44610#msg44610
This fix works as expected.