Issue : Configure openresty/nginx to use a single port (8080) for both SSL (for web and SSH endpoints) and plain HTTP connection (for noMachine HTTP CONNECT)
@@ -15,6 +15,31 @@ env API_EXTERNAL;
env EDGE_EXTERNAL;
env EDGE_EXTERNAL_SCHEMA;
+# - SSL/TLS traffic will go to port 8181 (HTTP Reverse proxy for interactive web and in-browser sessions)
+# - While plain HTTP traffic will go to a forward proxy and will be considered as HTTP CONNECT method
+# (this is typically used for the noMachine sessions, which does not support HTTPS CONNECT)
+stream {
+ upstream reverse_proxy {
+ server 127.0.0.1:8181;
+ }
+
+ upstream forward_proxy {
+ server 127.0.0.1:8282;
+ }
+
+ map $ssl_preread_protocol $proxy_type {
+ "" forward_proxy;
+ default reverse_proxy;
+ }
+
+ server {
+ listen 8080;
+
+ proxy_pass $proxy_type;
+ ssl_preread on;
+ }
+}
+
http {
client_max_body_size 500M;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
@@ -25,8 +50,8 @@ http {
lua_package_path "/usr/local/openresty/lualib/?.lua;;";
server {
- listen 8080 ssl;
- server_name _;
+ listen 8181 ssl;
+
absolute_redirect off;
# SSL
@@ -58,7 +83,7 @@ http {
}
server {
- listen 8081;
+ listen 8282;
# dns resolver used by forward proxying
resolver 8.8.8.8;
