Dynmap's internal webserver, when reverse-proxied to domain subdir, expects files to be in incorrect locations
unilock opened this issue · 9 comments
Issue Description: When Dynmap's internal webserver is reverse-proxied to a subdirectory of a domain, it expects its files (config.js
, css/
, up.php
, etc.) to be at the root of the domain, rather than the subdirectory of the domain.
- Dynmap Version: Dynmap-3.4-SNAPSHOT-spigot
- Server Version: Paper 1.19, build 17
- Pastebin of Configuration.txt: https://pastebin.com/XyRERTux
- Server Host (if applicable): self-hosted (Debian sid, uname =
5.18.0-1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.2-1 (2022-06-06) x86_64 GNU/Linux
- Pastebin of crashlogs or other relevant logs: N/A, screenshot of JS console @ https://play.example.com/map/index.html
- Other Relevant Data/Screenshots:
- Relevant apache2 configuration (note that the
play.
subdomain isn't necessary here) - Dynmap shows a blank white screen with title "Minecraft Dynamic Map" @
example.com/map
- Dynmap shows a blank black screen with title "Minecraft Dynamic Map" @
example.com/map/index.html
- While messing with apache2 configurations, I got this URL work once, but I can't recall how...
- Relevant apache2 configuration (note that the
- Steps to Replicate:
- Start a Spigot-based Minecraft server
- Install the Dynmap plugin
- Set up a webserver that reverse-proxies Dynmap's internal webserver to a subdomain
- i.e
http://localhost:8123/
tohttps://example.com/map
- I imagine this issue isn't strictly limited to apache2; it should exist on nginx and other webservers
- i.e
Basically, this works (apache2):
ProxyPass / http://localhost:8123
But this does not:
ProxyPass /map http://localhost:8123
I imagine this can be solved by using Dynmap's external webserver configuration, but that seems unnecessarily complicated - I would have to re-copy Dynmap's ./plugins/dynmap/web
directory every time I update Dynmap, no?
Another solution would be to manually reverse-proxy each and every file and directory Dynmap looks for, as seen here, but that's terribly ineloquent.
[x] I have looked at all other issues and this is not a duplicate
[x] I have been able to replicate this
@Velosofy That worked! Though I'm not sure why. (Note that, while example.com/map
still does not work, example.com/map/
- note the trailing slash - and example.com/map/index.html
do work.)
Here's the relevant bit of my apache2 configuration:
Redirect "/map" "/map/index.html"
<Location /map/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
ProxyPass http://localhost:8123/
ProxyPassReverse http://localhost:8123/
</Location>
(Using mod_rewrite
to go from ^map$
to map/index.html
didn't work, for some reason...)
Should I keep this issue open? This solution is good enough, but I feel that it should still be possible to access Dynmap from e.g. example.com/map
(no trailing slash).
I'm sorry but doesn't it redirect example.com/map
in your browser to example.com/map/
anyway?
At least that's my case. That's why I don't bother to open a issue or try a different approach
@Velosofy Not by default, hence the need for Redirect "/map" "/map/index.html"
. Otherwise I get a 404 @ example.com/map
.
Oh, perhaps that only apply with nginx. I can't help you further to fill your needs
or this instead:
Redirect "/map" "/map/"
<Location /map/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
ProxyPass http://localhost:8123/
ProxyPassReverse http://localhost:8123/
</Location>
@brunoherrera Yes, Redirect "/map" "/map/index.html"
and Redirect "/map" "/map/"
are practically identical in this case.
@Velosofy If we consider /
to be the root directory of a website, then /map
would be a subdir thereof.
https://example.com/
vs.
https://example.com/map