Proxy Preserve Host

Hi
I want to run an application running on the domain running on a server that is running on the port:
127.0.0.1:5001 In apache, I used vhost: <code class="CodeInline">ProxyPreserveHost On ProxyPass / http://127.0.0.1:5001/ ProxyPassReverse / http://127.0.0.1:5001/
or in nginx:
location / {
proxy_pass http://127.0.0.1:5001;
}`
And the application worked on the domain.
How to get this effect in OpenLiteSpeed?

Hello, you can do that.

Easy way

Paste following in your: /usr/local/lsws/conf/httpd_config.conf

extprocessor proxyapp {
  type                    proxy
  address                 127.0.0.1:5001
  maxConns                100
  pcKeepAliveTimeout      60
  initTimeout             60
  retryTimeout            0
  respBuffer              0
}

Now you can use rewrite rules to proxy traffic to this External App:

RewriteRule ^(.*)$ HTTP://proxyapp/$1 [P]

For more details visit these links:

https://openlitespeed.org/kb/proxying-with-rewrite-rules/

Diękuję for the quick reply.
Can you explain to me how to do if I wanted to run 2 different applications on 2 domains:
domain 1 port 5000
domain 2 port 5001
How would this solution look like?

You will have two external apps in your /usr/local/lsws/conf/httpd_config.conf

extprocessor proxyapp1 {
  type                    proxy
  address                 127.0.0.1:5000
  maxConns                100
  pcKeepAliveTimeout      60
  initTimeout             60
  retryTimeout            0
  respBuffer              0
}

extprocessor proxyapp2 {
  type                    proxy
  address                 127.0.0.1:5001
  maxConns                100
  pcKeepAliveTimeout      60
  initTimeout             60
  retryTimeout            0
  respBuffer              0
}


Then your first domain rewrite rules:

RewriteRule ^(.*)$ HTTP://proxyapp1/$1 [P]

Second domain:

RewriteRule ^(.*)$ HTTP://proxyapp2/$1 [P]

Thank you for fast help.
Does ftp work on the latest version?

Thank you for fast help. Does ftp work on the latest version?

You might be using the Non-TLS connection for FTP, new versions do not enforce TLS connections. But you can always switch to TLS connections as they are more secure.

If you still have issues, feel free to report.

I tried the same rewrite rules, initially it was working for cp.mydomain.com. After that I installed Nodejs and started an application at a port (Eg: 4884).

I created another subdomain say, node.mydomain.com and added redirect rule. Now, both the subdomains are not directing to the defined port.

I created extprocessors like below

extprocessor cyberpanel {
type proxy
address 127.0.0.1:8090
maxConns 100
pcKeepAliveTimeout 60
initTimeout 60
retryTimeout 0
respBuffer 0
}

extprocessor node {
type proxy
address 127.0.0.1:4884
maxConns 100
pcKeepAliveTimeout 60
initTimeout 60
retryTimeout 0
respBuffer 0
}

and added rewrite rule as below

RewriteEngine On
RewriteRule ^(.*)$ HTTP://cyberpanel/$1 [P]

RewriteEngine On
RewriteRule ^(.*)$ HTTP://node/$1 [P]

I just started using Cyberpanel and it looks great. I wanted to move from my old Nginx server to Cyberpanel ols server. Please help.

I’m having the same issue as smarteer here, I followed the steps of usmannasir, I already spent almost 10 hours trying to figure out a way to solve my problem. Nothing seems to work for me. Please help. My client is waiting.

Hello is there away we can use pass-through instead of proxy?
I have use [PT] flag in rewrite rules but what would be the ‘type’ value in extProcessor?

Hello, Will this work for external public IP:port? Thank you. :smile: