jhuckaby/Cronicle

Cannot deploy Cronicle at subpath

larsblumberg opened this issue · 2 comments

Summary

Using Digital Ocean Apps Platform, Cronicle is deployed to a subpath, i.e. at https://my-domain.com/cronicle/. Unfortunately Cronicle seems to use absolute script URLs which makes Cronicle not loading.

Steps to reproduce the problem

Deploy Cronicle at a subpath. One could use a nginx forward proxy to simulate this locally.

Your Setup

Default setup but serving Cronicle at a subpath.

Operating system and version?

Docker imaged based on FROM node:lts-bullseye

Node.js version?

20.15.1

Cronicle software version?

0.9.56

Are you using a multi-server setup, or just a single server?

Single server

Are you using the filesystem as back-end storage, or S3/Couchbase?

S3

Can you reproduce the crash consistently?

Yes

Log Excerpts

Untitled

Since these URLs don't exist, a 404 page is returned which contains HTML code. Leading to a JSON parse error, because Cronicle expected a script:

image

I'm so sorry, but Cronicle has no support for running in a subpath. It is designed to own the origin it is running on. This would be way too difficult to redesign. Apologies.

You can run it on a subdomain, like: cronicle.my-domain.com.

Thanks for your reply! I understand that making these changes would require a little effort. I had started patching Cronicle to respect a subpath, it wasn't too much. I.e. adding a <base href="https://domain.com/cronicle"> to the web app so that all URLs are made relative that base URL. That required removing a leading slash such as in <iframe href="/api/..."> -> <iframe href="api/...">. Additionally I patched the api.post() and api.get() function which made Cronicle more or less work.

However I am afraid that these patches would need to be maintained and merged into future versions.

A drawback of using a distinct subdomain is that Digital Ocean charges extra for assigned IPs, which in my case are required due to Postgres authorization settings. This said, I'd have loved to keep Cronicle running in an existing Digital Ocean app at a subpath, but I totally understand the extra efforts involved.

Thanks for having replied that quickly and thanks for the great work on Cronicle!