Skip to content

M8F-56: Fix local development issue by updating Vite host and backend proxy configuration#72

Merged
auslin-aot merged 2 commits intoAOT-Technologies:mainfrom
sonal-aot:bugfix/M8F-56-local-dev-runtime-issue
Mar 16, 2026
Merged

M8F-56: Fix local development issue by updating Vite host and backend proxy configuration#72
auslin-aot merged 2 commits intoAOT-Technologies:mainfrom
sonal-aot:bugfix/M8F-56-local-dev-runtime-issue

Conversation

@sonal-aot
Copy link
Collaborator

@sonal-aot sonal-aot commented Mar 11, 2026

JIRA Ticket

M8F-56

Description

Fix infinite login redirect loop when running frontend locally via npm start.

Problem

The Vite dev server proxy in extensions/frontend/vite.config.ts had the backend
proxy target hardcoded to http://localhost:8000. When the backend runs on a
non-localhost IP (e.g., http://192.168.1.77:8000), all proxied API requests
(/v1.0/*) were sent to the wrong host, causing every call to fail with a
connection error → 401 Unauthorized → redirect to login → infinite redirect loop.

This issue did not affect Docker because Docker uses nginx for routing internally,
bypassing the Vite proxy entirely.

Fix

The proxy target is now dynamically resolved from the root .env file using the
existing M8FLOW_BACKEND_URL_FRONTEND / M8FLOW_BACKEND_URL variables — the same
values already used for the backend itself.

// Before — hardcoded, breaks non-localhost setups
target: `http://localhost:${backendPort}`

// After — reads real backend URL from .env
const backendUrl =
  rootEnv.M8FLOW_BACKEND_URL_FRONTEND ||
  rootEnv.M8FLOW_BACKEND_URL ||
  process.env.M8FLOW_BACKEND_URL ||
  `http://localhost:${backendPort}`;

proxy: { '/v1.0': { target: backendUrl } }

Type

  • Feature
  • Bug fix
  • Documentation
  • Other

Changes

  • Backend
  • Frontend
  • Documentation

Testing

Local Dev (npm start)

  • Started the backend on http://192.168.1.77:8000 (non-localhost IP)
  • Ran npm start from extensions/frontend/
  • Opened http://localhost:8001 in the browser
  • Logged in via Keycloak — login completed successfully without redirect loops
  • Verified API calls (/v1.0/permissions-check, /v1.0/status) returned 200 OK
    with the Authorization token correctly attached in request headers
  • Confirmed no infinite login redirects in the browser Network tab

Docker (regression check)

  • Built and ran the full stack via Docker Compose
  • Login and API calls continued to work as expected — no regression

Related Issues

Closes M8F-56

…figurable `backendUrl` from environment variables, and use it for API proxy targets.
@sonarqubecloud
Copy link

Copy link
Collaborator

@andrepestana-aot andrepestana-aot left a comment

Choose a reason for hiding this comment

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

Looks good.

@auslin-aot auslin-aot merged commit be84b34 into AOT-Technologies:main Mar 16, 2026
9 checks passed
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.

4 participants