Fix rewriting rules default site conf - see linuxserver/docker-cops#31

This commit is contained in:
mikespub 2024-05-07 13:52:25 +02:00
parent b9d1cb9029
commit efe5296e70
2 changed files with 14 additions and 3 deletions

View File

@ -70,6 +70,7 @@ app_setup_block: |
# changelog
changelogs:
- { date: "07.05.24:", desc: "Existing users should verify: site-confs/default.conf - Fix rewriting rules default site conf." }
- { date: "20.03.24:", desc: "Rebase to Alpine 3.19." }
- { date: "25.12.23:", desc: "Existing users should update: site-confs/default.conf - Cleanup default site conf." }
- { date: "11.08.23:", desc: "Undeprecate and add new branch with mikespub fork which is actively maintained." }

View File

@ -1,4 +1,4 @@
## Version 2023/12/25 - Changelog: https://github.com/linuxserver/docker-cops/commits/master/root/defaults/nginx/site-confs/default.conf.sample
## Version 2024/05/07 - Changelog: https://github.com/linuxserver/docker-cops/commits/master/root/defaults/nginx/site-confs/default.conf.sample
server {
listen 80 default_server;
@ -14,13 +14,23 @@ server {
root /app/www/public;
index index.html index.htm index.php;
#Useful only for Kobo reader
location /cops/ {
#URL rewriting with COPS - see https://github.com/seblucas/cops/wiki/Url-Rewriting-with-COPS
location /download/ {
rewrite ^/download/(\d+)/(\d+)/.*\.kepub\.epub$ /fetch.php?data=$1&db=$2&type=epub last;
rewrite ^/download/(\d+)/(\d+)/.*\.(.*)$ /fetch.php?data=$1&db=$2&type=$3 last;
rewrite ^/download/(\d+)/.*\.kepub\.epub$ /fetch.php?data=$1&type=epub last;
rewrite ^/download/(\d+)/.*\.(.*)$ /fetch.php?data=$1&type=$2 last;
break;
}
location /view/ {
rewrite ^/view/(\d+)/(\d+)/.*\.kepub\.epub$ /fetch.php?data=$1&db=$2&type=epub&view=1 last;
rewrite ^/view/(\d+)/(\d+)/.*\.(.*)$ /fetch.php?data=$1&db=$2&type=$3&view=1 last;
rewrite ^/view/(\d+)/.*\.kepub\.epub$ /fetch.php?data=$1&type=epub&view=1 last;
rewrite ^/view/(\d+)/.*\.(.*)$ /fetch.php?data=$1&type=$2&view=1 last;
break;
}
#Can break loading the images - if you don't see anything, comment
location ~ ^/images.*\.(gif|png|ico|jpg)$ {
expires 31d;