Skip to content

Wrong redirect to HAL Browser for tag and environment when Pact Broker is running behind a proxy with an additional path #898

@koltsovdd

Description

@koltsovdd

Hello! I’m having an issue with HAL Browser redirects from the matrix table.

I’m running Pact Broker via Docker Compose (Postgres + Pact Broker) behind Nginx, and I serve it under an additional path prefix: pact-broker-api/. I also set PACT_BROKER_BASE_URLS to include the prefixed URLs.

In the matrix table:

  1. Consumer version number link works
    The “consumer version number” link is an absolute URL like this, and it works correctly:

https://<HOST>/pact-broker-api/hal-browser/browser.html#https://<HOST>/pact-broker-api/pacticipants/<PACTICIPANT>/versions/<VERSION>

  1. Tag link redirects incorrectly
    The “tag” link is rendered as a relative path like this:

/hal-browser/browser.html#/pacticipants/<PACTICIPANT>/versions/<VERSION>/tags/<TAG>

When I click it, it redirects to:

https://<HOST>/hal-browser/browser.html#/pacticipants/<PACTICIPANT>/versions/<VERSION>/tags/<TAG>

Notice the missing pact-broker-api/ prefix.

Expected
https://<HOST>/pact-broker-api/hal-browser/browser.html#/pacticipants/<PACTICIPANT>/versions/<VERSION>/tags/<TAG>

Is there a recommended way to configure Pact Broker / Nginx so that these relative HAL Browser links include the path prefix?
I noticed in the code that different logic is used to build the consumer version link vs. the tag link—maybe the tag link is not using the configured base URL(s)?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions