Skip to content

Commit dfdce15

Browse files
caoccaovanch3d
andauthored
Support Relative Paths for Reverse Proxy (#1041)
Co-authored-by: Nicolas Van Labeke <[email protected]>
1 parent dc79b7a commit dfdce15

File tree

22 files changed

+163
-58
lines changed

22 files changed

+163
-58
lines changed

.github/workflows/check-frontend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
working-directory: ./hivemq-edge-frontend/
6969

7070
- name: 🏗️ Build Application
71-
run: pnpm run build
71+
run: pnpm run build --base=/
7272

7373
- name: Upload artifact
7474
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ out/
2121
/hivemq-edge/src/distribution/log/migration.log
2222
/hivemq-edge/src/test/resources/opc-large-config.xml
2323
/edge-plugins/.kotlin/
24+
.vscode/

ext/hivemq-edge-openapi-2025.12-SNAPSHOT.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3842,6 +3842,12 @@ paths:
38423842
get:
38433843
description: Obtain a list of available protocol adapter types.
38443844
operationId: getAdapterTypes
3845+
parameters:
3846+
- name: X-Original-URI
3847+
in: header
3848+
required: false
3849+
schema:
3850+
type: string
38453851
responses:
38463852
'200':
38473853
content:

ext/openAPI/paths/api_v1_management_protocol-adapters_types.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
get:
22
description: Obtain a list of available protocol adapter types.
33
operationId: getAdapterTypes
4+
parameters:
5+
- name: X-Original-URI
6+
in: header
7+
required: false
8+
schema:
9+
type: string
410
responses:
511
'200':
612
content:

hivemq-edge-frontend/.env.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
VITE_API_BASE_URL=http://localhost:8080
1+
VITE_API_BASE_URL=http://localhost:8080/
22

hivemq-edge-frontend/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@ The web app will be running on http://localhost:3000/app/login
8686
To build a version ready for deployment, run the command
8787

8888
```shell
89+
# Relative path for production.
8990
pnpm run build
91+
# Absolute path for dev / test.
92+
pnpm run build --base=/
9093
```
9194

9295
## OpenAPI

hivemq-edge-frontend/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ val buildFrontend by tasks.registering(PnpmTask::class) {
2323
environment = mapOf(
2424
"NODE_OPTIONS" to "--max-old-space-size=4096",
2525
)
26-
pnpmCommand.set(listOf("build", "--base=/app"))
26+
pnpmCommand.set(listOf("build", "--base=./"))
2727
dependsOn(tasks.pnpmInstall)
2828
inputs.dir(project.fileTree("src"))
2929
inputs.dir(project.fileTree("public"))

hivemq-edge-frontend/cypress/e2e/Login/login.spec.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('Login Page', () => {
2525
})
2626

2727
it('should redirect to login', () => {
28-
cy.visit('/app')
28+
cy.visit('/app/')
2929
cy.url().should('contain', '/login')
3030
})
3131

hivemq-edge-frontend/cypress/pages/Page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export abstract class Page {
55
// so we must tell it to visit our website with the `cy.visit()` command.
66
// Since we want to visit the same URL at the start of all our tests,
77
// we include it in our beforeEach function so that it runs before each test
8-
cy.visit(route || '/app', {
8+
cy.visit(route || '/app/', {
99
onBeforeLoad(win: Cypress.AUTWindow) {
1010
// This config need to be more controllable
1111
win.localStorage.setItem('edge.privacy', JSON.stringify({ heapAnalytics: false, sentry: false }))

hivemq-edge-frontend/src/__test-utils__/adapters/simulation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const MOCK_PROTOCOL_SIMULATION: ProtocolAdapter = {
99
'Simulates device message traffic to enable observation of adapter behavior without the need to configure actual devices.',
1010
url: 'https://docs.hivemq.com/hivemq-edge/protocol-adapters.html#simulation-adapter',
1111
version: 'Development Version',
12-
logoUrl: '/module/images/hivemq-icon.png',
12+
logoUrl: '../../module/images/hivemq-icon.png',
1313
author: 'HiveMQ',
1414
installed: true,
1515
capabilities: ['READ'],

0 commit comments

Comments
 (0)