Reverse Proxy on OpenLiteSpeed

I have Cyberpanel + Openlitespeed/Litespeed,
How to make these following lines work with Openlitespeed/Litespeed ? (Not Nginx / Apache)

I am about to deploy, waiting for this please

# Main server block.
server {

# Set default backend.
set $backend "WordPress";

# 1. Use WordPress for all the URLs that start with `/wp-`.
location /wp- {
	try_files $uri $uri/ /index.php$is_args$args;
}

# 2. Use WordPress for all the TXT and XML files.
location ~ \.(txt|xml|xsl)$ {
	try_files $uri $uri/ /index.php$is_args$args;
}

# 3. Use Frontity for all the URLs that start with `/static`.
location /static {
	set $backend "Frontity";
	proxy_pass http://localhost:3000;
}

# 4. The rest of the URLs.
location / {
	# 4.1 Use Frontity if there is no WordPress auth cookie.
	if ($http_cookie !~* "wordpress_logged_in") {
		set $backend "Frontity";
		proxy_pass http://localhost:3000;
	}
	# 4.2 Use WordPress with Embedded mode if there is an auth cookie.
	try_files $uri $uri/ /index.php$is_args$args;
}

add_header "X-Backend" $backend;  }`

its been almost a week, since you wrote the code can you please help.

@furrysmile2 I have never used LiteSpeed, sorry.

It seems like a reverse proxy can be configured with Apache-like syntax (https://openlitespeed.org/kb/advanced-reverse-proxy/), which I am not familiar with to, but I am sure you can find much more information :slightly_smiling_face:

1 Like