Open dyimo opened 1 year ago
I tried using the code below but it doesn't work:
set $fixed_destination $http_destination;
if ( $http_destination ~* ^https(.*)$ ) {
set $fixed_destination http$1;
}
proxy_set_header Destination $fixed_destination;
https://docutain.zendesk.com/hc/en-001/community/posts/5862028974994-Integration-Nginx-Proxy-Manager-Synology-WebDAV-Server You can try this, I successfully solved the problem by this method.
https://docutain.zendesk.com/hc/en-001/community/posts/5862028974994-Integration-Nginx-Proxy-Manager-Synology-WebDAV-Server You can try this, I successfully solved the problem by this method.
Which webdav client are you using? win10
Having the same problem here. https://www.dimoulis.net/posts/webdav-behind-reverse-proxy/ explains the problem is "MOVE and COPY methods use a Destination header that must match the scheme of Host e.g. https for https and not http. This isn’t true behind a reverse proxy.".
The page proceeds to offer a solution for standard Nginx configurations, but I can't get that to work in nginx-proxy-manager.
Hoping someone more clever can convert this so it works. I searched high and low for a solution to this, and though many are having the problem I don't find any conclusive solution.
upstream webdav {
server 127.0.0.1:8080;
keepalive 32;
}
server {
server_name domain.tld;
root /var/www/html;
access_log /var/log/nginx/domain.tld;
client_max_body_size 0;
location / {
auth_basic "Restricted area";
auth_basic_user_file /etc/nginx/.htpasswd;
# https://mailman.nginx.org/pipermail/nginx/2007-January/000504.html - fix Destination: header
# https://trac.nginx.org/nginx/ticket/348 - bug, workaround with named capture
set $dest $http_destination;
if ($http_destination ~ "^https://(?<myvar>(.+))") {
set $dest http://$myvar;
}
proxy_set_header Destination $dest;
#rewrite /webdav/(.*) /$1 break;
proxy_pass http://webdav;
proxy_buffering off;
# Keep-alive
proxy_http_version 1.1;
proxy_set_header Connection "";
# Proxy headers
proxy_set_header Host $host;
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_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
# Proxy timeouts between successive read/write operations, not the whole request.
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
listen [::]:443 ssl http2;
listen 443 ssl http2;
# ... SSL stuff ...
}
@Waldorf3 This config can not work in nginx-proxy-manager because all commands you write in Advanced
tab will be placed inside the server{}
block. But the upstream{}
must be outside the server{}
block.
So, here's a working version for NPM:
# no upstream{} block
client_max_body_size 0;
location / {
# add your upstream directly
proxy_pass http://192.168.1.1:5005;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
set $dest $http_destination;
if ($http_destination ~ "^https://(?<myvar>(.+))") {
set $dest http://$myvar;
}
proxy_set_header Destination $dest;
}
@Waldorf3 This config can not work in nginx-proxy-manager because all commands you write in
Advanced
tab will be placed inside theserver{}
block. But theupstream{}
must be outside theserver{}
block.So, here's a working version for NPM:
# no upstream{} block client_max_body_size 0; location / { # add your upstream directly proxy_pass http://192.168.1.1:5005; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Port $server_port; proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s; set $dest $http_destination; if ($http_destination ~ "^https://(?<myvar>(.+))") { set $dest http://$myvar; } proxy_set_header Destination $dest; }
I'm running in Docker, and I followed the configuration in the advanced settings as mentioned above, but it still doesn't work. Can you assist?
I'm running in Docker, and I followed the configuration in the advanced settings as mentioned above, but it still doesn't work. Can you assist?
@JayLiuX 192.168.1.1
indicates local host, which is your docker container itself instead of the host. So, change it to your host's ip address.
Alternative, use host.docker.internal
to represent the host. But in this case, please add the following to your compose.yml:
version: '3.8'
services:
xxx:
# add this ↓
extra_hosts:
- "host.docker.internal:host-gateway"
If you use command line directly, add --add-host=host.docker.internal:host-gateway
to make sure this magic domian points to the host.
I'm running in Docker, and I followed the configuration in the advanced settings as mentioned above, but it still doesn't work. Can you assist?
@JayLiuX
192.168.1.1
indicates local host, which is your docker container itself instead of the host. So, change it to your host's ip address.Alternative, use
host.docker.internal
to represent the host. But in this case, please add the following to your compose.yml:version: '3.8' services: xxx: # add this ↓ extra_hosts: - "host.docker.internal:host-gateway"
If you use command line directly, add
--add-host=host.docker.internal:host-gateway
to make sure this magic domian points to the host.
@ichenhe Here is my configuration. Among them, 192.168.31.215:5244 is the access address for my alist. Would you mind adding my contact information?I have sent my contact information to your email.
same problem
Originally posted by @ensleep in https://github.com/NginxProxyManager/nginx-proxy-manager/issues/503#issuecomment-1257702561