Skip to content

Serve the ical aliases in node dev (#1121) - #1122

Open
dduugg wants to merge 1 commit into
shift-org:mainfrom
dduugg:ics-dev-aliases
Open

dduugg wants to merge 1 commit into
shift-org:mainfrom
dduugg:ics-dev-aliases

Conversation

@dduugg

@dduugg dduugg commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #1121.

nginx serves ical.php under two other names — ics.php, where every Export link points, and shift-calendar.php, the webcal feed. Node dev has no nginx, so both 404'd there.

This mirrors the two aliases in app/facade.js, which already stands in for nginx and Netlify under npm run dev. It rewrites the URL and falls through to the real endpoint, the same way nginx's proxy_pass does, so the query string carries over unchanged.

The facade only loads when SHIFT_STATIC_FILES is set, so Docker and production are untouched and keep using nginx's aliases.

Verification

Against npm run dev, before and after:

request before after
/api/ics.php?event_id=11 404 200
/api/ics.php?startdate=…&enddate=… 404 200
/api/ics.php?event_id=99999 404 404 (from ical.php itself now)
/api/shift-calendar.php 404 200

The alias responses are byte-identical to the matching ical.php request, including the content-disposition filename.

In the browser, the Export link on both the theme event page (/calendar/event-11) and the Vue event page (/events/3/11/) points at /api/ics.php and now returns a BEGIN:VCALENDAR body. I fetched the link rather than clicking it, to avoid triggering a download.

Backend suite: 55 passed, 0 failed. The facade isn't loaded under test.

nginx serves ical.php under two other names: ics.php, which is where
every Export link points, and shift-calendar.php, the webcal feed.
Node dev has no nginx, so both 404'd there. Mirror the aliases in the
facade, which only runs under npm run dev; docker and production keep
using nginx's.
@ionous
ionous self-requested a review October 16, 2026 18:28

@ionous ionous left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure this is the best way to fix #1121
it feels like maybe instead we should normalize the endpoint requests so that they all use the same thing -- whichever that is....

@dduugg

dduugg commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Makes sense. Looking at it again, most of the ics.php requests come from our own code:

  • app/models/calDaily.js: the exportable url in api responses
  • cal/src/support/dataPool.js and the theme's assets/js/cal/config.js: API_ICS_URL

So I could switch those to /api/ical.php (the endpoint's actual name) and drop the alias from facade.js. shift-calendar.php is different: it's the published webcal subscription url, so I'd leave those links and the nginx/netlify aliases alone for existing subscribers.

Changing exportable changes api output, so it would get a CALENDAR_API.md entry and a version bump.

Does ical.php sound like the right name to standardize on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export links and the webcal feed 404 under npm run dev

2 participants