diff --git a/plogical/DockerSites.py b/plogical/DockerSites.py index 181d53855..4e6c8f12d 100644 --- a/plogical/DockerSites.py +++ b/plogical/DockerSites.py @@ -244,8 +244,8 @@ extprocessor docker{port} {{ type proxy address 127.0.0.1:{port} maxConns 100 - pcKeepAliveTimeout 60 - initTimeout 60 + pcKeepAliveTimeout 3600 + initTimeout 300 retryTimeout 0 respBuffer 0 }} @@ -272,10 +272,10 @@ extprocessor docker{port} {{ ET.SubElement(new_ext_processor, 'type').text = 'proxy' ET.SubElement(new_ext_processor, 'name').text = f'docker{port}' ET.SubElement(new_ext_processor, 'address').text = f'127.0.0.1:{port}' - ET.SubElement(new_ext_processor, 'maxConns').text = '35' - ET.SubElement(new_ext_processor, 'pcKeepAliveTimeout').text = '60' - ET.SubElement(new_ext_processor, 'initTimeout').text = '60' - ET.SubElement(new_ext_processor, 'retryTimeout').text = '60' + ET.SubElement(new_ext_processor, 'maxConns').text = '100' + ET.SubElement(new_ext_processor, 'pcKeepAliveTimeout').text = '3600' + ET.SubElement(new_ext_processor, 'initTimeout').text = '300' + ET.SubElement(new_ext_processor, 'retryTimeout').text = '0' ET.SubElement(new_ext_processor, 'respBuffer').text = '0' # Append the new to the @@ -289,6 +289,56 @@ extprocessor docker{port} {{ ET.dump(root) + @staticmethod + def SetupN8NVhost(domain, port): + """Setup n8n vhost with proper proxy configuration including Origin header""" + try: + vhost_path = f'/usr/local/lsws/conf/vhosts/{domain}/vhost.conf' + + if not os.path.exists(vhost_path): + logging.writeToFile(f"Error: Vhost file not found at {vhost_path}") + return False + + # Read existing vhost configuration + with open(vhost_path, 'r') as f: + content = f.read() + + # Check if context already exists + if 'context / {' in content: + logging.writeToFile("Context already exists, skipping...") + return True + + # Add proxy context with proper headers for n8n + proxy_context = f''' + +# N8N Proxy Configuration +context / {{ + type proxy + handler docker{port} + addDefaultCharset off + websocket 1 + + extraHeaders <<