Skip to content

Commit

Permalink
fix nested folders not working on different basepath deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschubek committed Nov 2, 2023
1 parent d8da94d commit b26067b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions docs/docs/getting-started/reverse-proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ server {
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
ssl_certificate /path/to/cert.pem;
Expand Down Expand Up @@ -54,10 +52,16 @@ server {

</details>

### Subfolder/Subpath
Since version 1.3.1 you can deploy the application to a different basepath/subfolder e.g. `/foobar/` and all links, files and folders will be relative to this path.
### Subfolder/Different basepath
Since version 1.3.3 you can deploy the application to a different basepath/subfolder e.g. `/foobar/` and all links, files and folders will be relative to this path.

You may need to modify your reverse proxy configuration. In NGINX adapt the `location` block to the following:
Set the `BASE_PATH` environment variable to the subfolder you want to deploy the application to. For example:

```bash
docker run -d -p 8080:80 -e BASE_PATH="/foobar" -v /my/local/folder:/var/www/html/public:ro -v redissave:/var/lib/redis/ -it adrianschubek/dir-browser
```

And you may need to modify your reverse proxy configuration. In NGINX adapt the `location` block to the following:

```nginx
location /foobar/ {
Expand Down
2 changes: 1 addition & 1 deletion src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function __toString(): string
<?php
foreach ($sorted as $file) {
?>
<a href=".<?= $file->url ?>" class="list-group-item list-group-item-action d-grid gap-2 item">
<a href="${{`process.env.BASE_PATH ?? ''`}}$<?= $file->url ?>" class="list-group-item list-group-item-action d-grid gap-2 item">
<?php if ($file->name === "..") { ?>
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-corner-left-up" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
Expand Down

0 comments on commit b26067b

Please sign in to comment.