There is vhost config, which should be reverse proxy to the flask application, and is not working. Below is the vhost config. Flask application is running on port 5000.
Added rewrite in both the context and outside, even then it's not working. Below config always gives the error 500.
vhDomain                  $VH_NAME
vhAliases                 www.$VH_NAME
enableGzip                1
enableIpGeo               1
index  {
  useServer               0
  indexFiles              index.php, index.html
}
errorlog $VH_ROOT/logs/$VH_NAME.error_log {
  useServer               0
  logLevel                WARN
  rollingSize             10M
}
accesslog $VH_ROOT/logs/$VH_NAME.access_log {
  useServer               0
  logFormat               "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i""
  logHeaders              5
  rollingSize             10M
  keepDays                10  
  compressArchive         1
}
extprocessor pythonflask1709 {
  type                    proxy
  address                 127.0.0.1:5000
  maxConns                200
  pcKeepAliveTimeout      60
  initTimeout             20
  retryTimeout            0
  respBuffer              0
}
scripthandler {
  add proxy:pythonflask1709 html
}
module cache {
 storagePath /usr/local/lsws/cachedata/$VH_NAME
}
rewrite  {
  enable 1
  autoLoadHtaccess 1
  RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  REWRITERULE ^(.*)$ HTTPS://127.0.0.1:5000/$1 [P]
}
context / {
  type                    proxy
  handler                 pythonflask1709
  addDefaultCharset       off
 
  rewrite  {
    enable 1
    autoLoadHtaccess 1
    RewriteEngine On
    RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    REWRITERULE ^(.*)$ HTTP://127.0.0.1:5000/$1 [P]
  }
}