Skip to content

Commit c446bfb

Browse files
authored
fix(nextcloud): nginx correct protocol for redirect (#826)
Signed-off-by: mike.reiche <mike@reiche.world>
1 parent c5650e1 commit c446bfb

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

charts/nextcloud/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: nextcloud
3-
version: 8.8.0
3+
version: 8.8.1
44
# renovate: image=docker.io/library/nextcloud
55
appVersion: 32.0.3
66
description: A file sharing server that puts the control and security of your own data back into your hands.

charts/nextcloud/files/nginx.config.tpl

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ upstream php-handler {
44
server 127.0.0.1:9000;
55
}
66

7+
map $http_x_forwarded_proto $real_scheme {
8+
default $scheme;
9+
https https;
10+
}
11+
12+
map $http_x_forwarded_port $real_port {
13+
default $server_port;
14+
443 443;
15+
}
16+
717
# Set the `immutable` cache control options only for assets with a cache busting `v` argument
818
map $arg_v $asset_immutable {
919
"" "";
@@ -87,7 +97,7 @@ server {
8797
# Rule borrowed from `.htaccess` to handle Microsoft DAV clients
8898
location = / {
8999
if ( $http_user_agent ~ ^DavClnt ) {
90-
return 302 /remote.php/webdav/$is_args$args;
100+
return 302 $real_scheme://$host:$real_port/remote.php/webdav/$is_args$args;
91101
}
92102
}
93103

@@ -104,12 +114,12 @@ server {
104114
location ^~ /.well-known {
105115
# The following 6 rules are borrowed from `.htaccess`
106116

107-
location = /.well-known/carddav { return 301 /remote.php/dav/; }
108-
location = /.well-known/caldav { return 301 /remote.php/dav/; }
117+
location = /.well-known/carddav { return 301 $real_scheme://$host:$real_port/remote.php/dav/; }
118+
location = /.well-known/caldav { return 301 $real_scheme://$host:$real_port/remote.php/dav/; }
109119

110120
# Let Nextcloud's API for `/.well-known` URIs handle all other
111121
# requests by passing them to the front-end controller.
112-
return 301 /index.php$request_uri;
122+
return 301 $real_scheme://$host:$real_port/index.php$request_uri;
113123
}
114124

115125
# Rules borrowed from `.htaccess` to hide certain paths from clients
@@ -158,7 +168,7 @@ server {
158168

159169
# Rule borrowed from `.htaccess`
160170
location /remote {
161-
return 301 /remote.php$request_uri;
171+
return 301 $real_scheme://$host:$real_port/remote.php$request_uri;
162172
}
163173

164174
location / {

0 commit comments

Comments
 (0)