Skip to content

Commit 31dc835

Browse files
committed
update redirect location and use front controller
1 parent a2530f4 commit 31dc835

3 files changed

Lines changed: 23 additions & 11 deletions

File tree

readme-vars.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ param_ports:
5757
# application setup block
5858
app_setup_block_enabled: true
5959
app_setup_block: |
60-
Access the webui at `http://<docker host ip>:80`. For connecting via OPDS on a mobile device use `http://<docker host ip>:80/index.php/feed`. It is strongly suggested that you reverse proxy this prior to exposing to the internet. For more information, such as requiring credentials, check the COPS Wiki (linked above).
60+
Access the webui at `http://<docker host ip>:80`. For connecting via OPDS on a mobile device use `http://<docker host ip>:80/index.php/feed` or `http://<docker host ip>:80/feed`. It is strongly suggested that you reverse proxy this prior to exposing to the internet. For more information, such as requiring credentials, check the COPS Wiki (linked above).
6161
6262
The linuxserver version gives you access to `config/local.php` in `/config` to customise your install to suit your needs, it also includes the dependencies required to directly view epub books in your browser.
6363
# init diagram
@@ -114,6 +114,7 @@ init_diagram: |
114114
"cops:latest" <- Base Images
115115
# changelog
116116
changelogs:
117+
- {date: "10.06.26:", desc: "Existing users should verify: site-confs/default.conf and config/local.php - Update redirect location and use front controller."}
117118
- {date: "08.02.26:", desc: "Existing users should update: site-confs/default.conf - Deny access to all dotfiles."}
118119
- {date: "08.02.26:", desc: "Adding missing php-tokenizer package."}
119120
- {date: "10.10.25:", desc: "Adding missing icu-data-full package."}

root/defaults/config/local.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
*/
3636
$config['cops_x_accel_redirect'] = "X-Accel-Redirect";
3737

38+
/*
39+
* Map /books/ to internal redirect location for COPS 4.2+
40+
*/
41+
$config['cops_x_accel_mapping'] = [
42+
'/books/' => '/_redirect_/',
43+
];
44+
3845
/* Enable cache folder
3946
* especially useful for lower power hosts
4047
*/
@@ -100,8 +107,6 @@
100107
* - Nginx: nginx.conf
101108
* - PHP built-in: router.php
102109
* - ...
103-
*
104-
* @todo update nginx/site-confs/default.conf.sample to make use of front controller
105110
*/
106-
$config['cops_front_controller'] = '';
107-
//$config['cops_front_controller'] = 'index.php';
111+
//$config['cops_front_controller'] = '';
112+
$config['cops_front_controller'] = 'index.php';

root/defaults/nginx/site-confs/default.conf.sample

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2026/02/08 - Changelog: https://github.com/linuxserver/docker-cops/commits/master/root/defaults/nginx/site-confs/default.conf.sample
1+
## Version 2026/02/10 - Changelog: https://github.com/linuxserver/docker-cops/commits/master/root/defaults/nginx/site-confs/default.conf.sample
22

33
server {
44
listen 80 default_server;
@@ -31,11 +31,6 @@ server {
3131
expires 31d;
3232
}
3333

34-
location /books {
35-
root /;
36-
internal;
37-
}
38-
3934
location ~ ^(.+\.php)(.*)$ {
4035
# enable the next two lines for http auth
4136
#auth_basic "Restricted";
@@ -48,6 +43,17 @@ server {
4843
include /etc/nginx/fastcgi_params;
4944
}
5045

46+
# use internal redirect location for X-Accel-Redirect - do not use /books/ or other COPS urls with front controller
47+
location /_redirect_/ {
48+
internal;
49+
alias /books/;
50+
}
51+
52+
# use front controller for COPS 4.2+
53+
location ~ ^/(?!(index\.php|_redirect_)) {
54+
try_files $uri /index.php$request_uri;
55+
}
56+
5157
# deny access to all dotfiles
5258
location ~ /\. {
5359
deny all;

0 commit comments

Comments
 (0)