diff --git a/locust/webui/src/components/StateButtons/ResetButton.tsx b/locust/webui/src/components/StateButtons/ResetButton.tsx
index be2c1aa33d..1746b4f9cb 100644
--- a/locust/webui/src/components/StateButtons/ResetButton.tsx
+++ b/locust/webui/src/components/StateButtons/ResetButton.tsx
@@ -2,7 +2,7 @@ import { Button } from '@mui/material';
export default function ResetButton() {
const onResetStatsClick = () => {
- fetch('stats/reset');
+ fetch((window.baseUrl ? `${window.baseUrl}/` : '') + 'stats/reset');
};
return (
diff --git a/locust/webui/src/components/StateButtons/StopButton.tsx b/locust/webui/src/components/StateButtons/StopButton.tsx
index c52cc3b53e..bc1fecae8a 100644
--- a/locust/webui/src/components/StateButtons/StopButton.tsx
+++ b/locust/webui/src/components/StateButtons/StopButton.tsx
@@ -9,7 +9,7 @@ export default function StopButton() {
}, []);
const onStopButtonClick = () => {
- fetch('stop');
+ fetch((window.baseUrl ? `${window.baseUrl}/` : '') + 'stop');
setIsLoading(true);
};
diff --git a/locust/webui/src/components/SwarmForm/SwarmForm.tsx b/locust/webui/src/components/SwarmForm/SwarmForm.tsx
index 913c31b212..59a3e81712 100644
--- a/locust/webui/src/components/SwarmForm/SwarmForm.tsx
+++ b/locust/webui/src/components/SwarmForm/SwarmForm.tsx
@@ -203,7 +203,9 @@ function SwarmForm({
>
)}
- {!isEmpty(extraOptions) && }
+ {!!extraOptions && !isEmpty(extraOptions) && (
+
+ )}
{alert && !errorMessage && (
{alert.message}
)}
diff --git a/locust/webui/src/constants/swarm.ts b/locust/webui/src/constants/swarm.ts
index 12a912251c..68faea9120 100644
--- a/locust/webui/src/constants/swarm.ts
+++ b/locust/webui/src/constants/swarm.ts
@@ -20,7 +20,7 @@ export const swarmTemplateArgs = window.templateArgs
export const htmlReportProps: IReport | false = !!(swarmTemplateArgs as IReportTemplateArgs)
.isReport && {
...(swarmTemplateArgs as IReportTemplateArgs),
- charts: swarmTemplateArgs.history?.reduce(
+ charts: (swarmTemplateArgs.history || []).reduce(
(charts, { currentResponseTimePercentiles, ...history }) =>
updateArraysAtProps(charts, { ...currentResponseTimePercentiles, ...history }),
{} as ICharts,
diff --git a/locust/webui/src/redux/api/swarm.ts b/locust/webui/src/redux/api/swarm.ts
index 64c84a874c..726db4d492 100644
--- a/locust/webui/src/redux/api/swarm.ts
+++ b/locust/webui/src/redux/api/swarm.ts
@@ -10,8 +10,18 @@ import {
import { createFormData } from 'utils/object';
import { camelCaseKeys, snakeCaseKeys } from 'utils/string';
+const baseQuery = (args: any, api: any, extraOptions: any) =>
+ fetchBaseQuery(
+ window.baseUrl
+ ? {
+ baseUrl: window.baseUrl,
+ credentials: 'include',
+ }
+ : undefined,
+ )(args, api, extraOptions);
+
export const api = createApi({
- baseQuery: fetchBaseQuery(),
+ baseQuery: baseQuery,
endpoints: builder => ({
getStats: builder.query({
query: () => 'stats/requests',
diff --git a/locust/webui/src/types/window.types.ts b/locust/webui/src/types/window.types.ts
index d437c2300d..f2d4187612 100644
--- a/locust/webui/src/types/window.types.ts
+++ b/locust/webui/src/types/window.types.ts
@@ -7,4 +7,5 @@ export interface IWindow {
templateArgs: IReportTemplateArgs | ISwarmState;
authArgs: IAuthArgs;
theme?: PaletteMode;
+ baseUrl?: string;
}