Skip to content

Fix cloud/static-hosting redirects: emit real HTML and wire CLOUD into go-publish#1327

Open
KyleOps wants to merge 1 commit into
HL7:masterfrom
KyleOps:fix/cloud-static-html-redirects
Open

Fix cloud/static-hosting redirects: emit real HTML and wire CLOUD into go-publish#1327
KyleOps wants to merge 1 commit into
HL7:masterfrom
KyleOps:fix/cloud-static-html-redirects

Conversation

@KyleOps

@KyleOps KyleOps commented Jun 17, 2026

Copy link
Copy Markdown

Problem

ServerType.CLOUD ("server": "cloud" in publish-setup.json) is intended for static
hosts — S3, GitHub Pages, Netlify, etc. that cannot execute server-side redirect
scripts. Two defects make the CLOUD path non-functional, so a cloud-hosted IG cannot get
working canonical-URL redirects.

Bug 1: HTML_TEMPLATE is a copy of PHP_TEMPLATE

IGReleaseRedirectionBuilder.HTML_TEMPLATE is a verbatim duplicate of PHP_TEMPLATE,
so createHtmlRedirect() writes PHP source into index.html. A static host serves that
as text/html, so the browser renders the raw PHP (including the trailing
"…PHP has failed badly" text) and never redirects.

Bug 2: -go-publish never selects the CLOUD path

PublicationProcess.updatePublishBox (the -go-publish path) has no CLOUD branch, so
cloud sites fall through to else if (!canonical.contains("hl7.org/fhir"))
buildApacheRedirections() and get PHP regardless of the configured server type.
(IGReleaseUpdater already handles CLOUD; this brings the go-publish path into line.)

Fix

  1. Replace HTML_TEMPLATE with a real static HTML redirect: <meta http-equiv="refresh">
    • window.location.replace(...) + <link rel="canonical">, plus JSON/XML links for
      machine clients. Content negotiation on Accept is not possible without a server
      runtime, so browsers are sent to the human-readable page.
  2. Add the missing else if (serverType == ServerType.CLOUD) rb.buildCloudRedirections();
    case to PublicationProcess.updatePublishBox, matching IGReleaseUpdater.

Testing

mvn -pl org.hl7.fhir.publisher.core compile passes. Generated index.html verified to
redirect correctly for ImplementationGuide / StructureDefinition / CodeSystem / ValueSet
canonical paths.

…o-publish

ServerType.CLOUD is intended for static hosts (S3, GitHub Pages, etc.) that
cannot execute server-side redirect scripts, but two defects made it
produce non-functional output:

1. HTML_TEMPLATE was a verbatim copy of PHP_TEMPLATE, so createHtmlRedirect()
   wrote PHP into index.html. Replaced it with a static HTML redirect
   (meta refresh + window.location.replace + canonical link), with JSON/XML
   links for machine clients. Content negotiation is not possible without a
   server runtime, so browsers go to the human-readable page.

2. PublicationProcess.updatePublishBox (the -go-publish path) had no CLOUD
   branch, so cloud sites fell through to buildApacheRedirections() and got
   PHP. Added the missing CLOUD -> buildCloudRedirections() case, matching
   IGReleaseUpdater.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant