RedReign / FoundryVTT-BetterRolls5e

A module for modifying certain sheet functions on Foundry VTT Character sheets for D&D 5th Edition.
GNU General Public License v3.0
37 stars 67 forks source link

BetterRolls5e not functioning behind nginx reverse proxy with subdirectory #95

Open gaggle331 opened 4 years ago

gaggle331 commented 4 years ago

I just setup my nginx reverse proxy on top of foundry with foundry set up in a subdirectory of my domain. Now the BetterRolls5e module is broken because it's trying to access the file at systems/dnd5e/module/config.js but which nginx is sending to https://MYHOST.THISISBROKEN/systems/dnd5e/module/config.js instead of https://MYHOST.THISISBROKEN/foundry/systems/dnd5e/module/config.js.

I believe this is a very simple fix, because the imports on lines 1 and 2 in /scripts/chat-damage-buttons.js have one too many ../ in them causing them to mess up the redirect. If you change it like below, it should work fine for both nginx reverse proxy configurations and others.

import { DND5E } from "../../../systems/dnd5e/module/config.js"; import Actor5e from "../../../systems/dnd5e/module/actor/entity.js";

crymic commented 4 years ago

Odd, I am running a nginx reverse proxy server and don't have this issue at all. is your "dataPath" setup correctly in the Foundry configuration? I believe the absolute path runs off that.

gaggle331 commented 4 years ago

I never touched the dataPath, I think that's the default. I tested my change in a fresh local install (without the nginx reverse proxy) and it works fine. Are you using a subdirectory (MYDOMAIN.COM/foundy) or a subdomain (foundry.MYDOMAIN.com)?

RedReign commented 4 years ago

I will look to fix this in upcoming versions, as these variables the script is trying to access will no longer need to be brought in through ES6 imports.

mkemp commented 4 years ago

I'm hitting the same issue. Confirmed that I see https://my.domain.com/modules/betterrolls5e/scripts/chat-damage-buttons.js being requested instead of https://my.domain.com/foundry-1/modules/betterrolls5e/scripts/chat-damage-buttons.js.

I'm using https://my.domain.com/foundry-1, https://my.domain.com/foundry-2, ..., https://my.domain.com/foundry-N as I run multiple worlds off the same server. This makes is easier since I only have to manage one SSL cert instead of one per subdomain (or a wildcard).

BetterRolls5e: 1.1.11 5e: 0.96 Foundry: 0.6.6

mkemp commented 4 years ago

@RedReign - Here's a PR with the fix.