Skip to content

"Dumb fix for HTMX Bug" breaks RT if RT is not installed in the web server root #84

@y-golonac

Description

@y-golonac

The "Dumb fix for HTMX Bug" actually breaks RT in the case it is supposed to fix:

# Dumb fix for HTMX Bug which rt team refuses to fix
# the main page does not honor WebPath and breaks if RT is not installed
# in the webserver root
RUN true && \
  case "${RT_VERSION}" in \
  "6."*) \
  sed -i 's/hx-get="<% RT::Interface::Web::RequestENV('"'"'REQUEST_URI'"'"') %>"/hx-get="<%RT->Config->Get('"'"'WebPath'"'"')%><% RT::Interface::Web::RequestENV('"'"'REQUEST_URI'"'"') %>"/' /opt/rt/share/html/Elements/Header \
  ;; \
  esac

with this Caddyfile

:8080 {
  log
  route /rt* {
    uri strip_prefix /rt
    reverse_proxy rt:9000 {
      transport fastcgi {
        env SCRIPT_NAME /rt
      }
    }
  }
}

and RT_SiteConfig.pm

Set($WebPath, '/rt');

For an URL of http://somewhere:8080/rt/ caddy passes these values:

SCRIPT_NAME=/rt
PATH_INFO=/
REQUEST_URI=/rt/

The "Dumb fix for HTMX Bug" causes hx_get contain the value /rt/rt/ which fails to load properly. It doubles the /rt prefix for other pages like http://somewhere:8080/rt/Dashboards/1/Homepage, causing them to fail to load properly as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions