Use newer Wt's proxy settings, fixes #532
This commit is contained in:
+6
-4
@@ -129,7 +129,10 @@ deploy-path = "/newroot/"; # ending slash is important
|
||||
```
|
||||
If you use nginx as a reverse proxy, you can simply replace `location /` with `location /newroot/` to achieve the same result.
|
||||
## Reverse proxy settings
|
||||
_LMS_ is shipped with an embedded web server, but it is recommended to deploy behind a reverse proxy. You have to set the _behind-reverse-proxy_ option to _true_ in the `lms.conf` configuration file.
|
||||
_LMS_ is shipped with an embedded web server, but it is recommended to deploy behind a reverse proxy. You have to set the `behind-reverse-proxy` option to _true_ in the `lms.conf` configuration file and to adjust the trusted proxy list in `trusted-proxies` option.
|
||||
|
||||
__Note__: when running in a docker environment, you have to trust the docker gateway IP (which is `172.17.0.1` by default)
|
||||
|
||||
Here is an example to make _LMS_ properly work on _myserver.org_ using _nginx_:
|
||||
```
|
||||
server {
|
||||
@@ -147,10 +150,9 @@ server {
|
||||
keepalive_timeout 10m;
|
||||
|
||||
location / {
|
||||
|
||||
proxy_set_header Client-IP $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_pass http://localhost:5082/;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB |
@@ -19,6 +19,13 @@ db-show-queries = false;
|
||||
listen-port = 5082;
|
||||
listen-addr = "0.0.0.0";
|
||||
behind-reverse-proxy = false;
|
||||
# original-ip-header and trusted-proxies are used only if behind-reverse-proxy is set to true
|
||||
original-ip-header = "X-Forwarded-For";
|
||||
trusted-proxies =
|
||||
(
|
||||
"127.0.0.1",
|
||||
"::1"
|
||||
);
|
||||
|
||||
# If enabled, these files have to exist and have correct permissions
|
||||
tls-enable = false;
|
||||
|
||||
+10
-1
@@ -137,7 +137,16 @@ namespace lms
|
||||
|
||||
// log-config
|
||||
pt.put("server.application-settings.log-config", core::logging::WtLogger::computeLogConfig(minSeverity));
|
||||
pt.put("server.application-settings.behind-reverse-proxy", core::Service<core::IConfig>::get()->getBool("behind-reverse-proxy", false));
|
||||
|
||||
// Reverse proxy
|
||||
if (core::Service<core::IConfig>::get()->getBool("behind-reverse-proxy", false))
|
||||
{
|
||||
pt.put("server.application-settings.trusted-proxy-config.original-ip-header", core::Service<core::IConfig>::get()->getString("original-ip-header", "X-Forwarded-For"));
|
||||
core::Service<core::IConfig>::get()->visitStrings("trusted-proxies", [&](std::string_view trustedProxy) {
|
||||
pt.add("server.application-settings.trusted-proxy-config.trusted-proxies.proxy", std::string{ trustedProxy });
|
||||
},
|
||||
{ "127.0.0.1", "::1" });
|
||||
}
|
||||
|
||||
{
|
||||
boost::property_tree::ptree viewport;
|
||||
|
||||
Reference in New Issue
Block a user