Skip to content

Commit

Permalink
location part
Browse files Browse the repository at this point in the history
  • Loading branch information
kulikov-a committed Apr 2, 2023
1 parent ef16b8b commit 41d7b74
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@
<advanced>true</advanced>
<help>If you enable the WebSocket Support option, nginx will pass the upgrade header to the backed server.</help>
</field>
<field>
<id>location.upstream_keepalive</id>
<label>Upstream Keepalive Support</label>
<type>checkbox</type>
<advanced>true</advanced>
<help>Add the directives required for upstream keepalive to work. Keepalive parameters must be set in Upstream settings also.</help>
</field>
<field>
<id>location.proxy_read_timeout</id>
<label>Proxy Read Timeout</label>
Expand Down
18 changes: 18 additions & 0 deletions www/nginx/src/opnsense/mvc/app/models/OPNsense/Nginx/Nginx.xml
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,25 @@
<websocket type="BooleanField">
<Required>Y</Required>
<default>0</default>
<Constraints>
<check001>
<ValidationMessage>WebSocket and Upstream Keepalive support can not be combined.</ValidationMessage>
<type>SingleSelectConstraint</type>
<addFields>
<field1>upstream_keepalive</field1>
</addFields>
</check001>
</Constraints>
</websocket>
<upstream_keepalive type="BooleanField">
<Required>Y</Required>
<default>0</default>
<Constraints>
<check001>
<reference>websocket.check001</reference>
</check001>
</Constraints>
</upstream_keepalive>
<proxy_buffer_size type="IntegerField">
<Required>N</Required>
<minValue>1</minValue>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ location {{ location.matchtype }} {{ location.urlpattern }} {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
{% endif %}
{% if location.upstream_keepalive is defined and location.upstream_keepalive == '1' %}
proxy_http_version 1.1;
proxy_set_header Connection "";
{% endif %}
{% if location.proxy_buffer_size is defined and location.proxy_buffer_size != '' %}
proxy_buffer_size {{ location.proxy_buffer_size }}k;
{% endif %}
Expand Down

0 comments on commit 41d7b74

Please sign in to comment.