Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions epictrack-web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RUN mkdir -p node_modules/.cache && chmod -R 777 node_modules/.cache
# add app files
COPY . ./

ENV PUBLIC_URL=/track
RUN npm run build

# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
Expand Down
12 changes: 8 additions & 4 deletions epictrack-web/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,19 @@ http {
listen 8080;
server_name _;

# Prevent nginx from adding internal port to redirects
absolute_redirect off;
port_in_redirect off;

index index.html;
error_log /dev/stdout info;
access_log /dev/stdout;

location / {
root /usr/share/nginx/html;
location /track {
alias /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
try_files $uri $uri/ /track/index.html;
}

error_page 500 502 503 504 /50x.html;

Expand Down
2 changes: 1 addition & 1 deletion epictrack-web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function App() {
return (
<AxiosErrorHandler>
{isLoggedIn && (
<Router>
<Router basename="/track">
<TrackErrorBoundary>
{uiState.showConfetti && <Confetti />}
<Box sx={{ display: "flex" }}>
Expand Down
4 changes: 4 additions & 0 deletions epictrack-web/src/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ declare global {
interface Window {
_env_: {
REACT_APP_API_URL: string;
REACT_APP_URL: string;

// Keycloak
REACT_APP_KEYCLOAK_URL: string;
Expand All @@ -14,6 +15,8 @@ declare global {
}
const API_URL =
window._env_?.REACT_APP_API_URL || process.env.REACT_APP_API_URL || "";
const APP_URL =
window._env_?.REACT_APP_URL || process.env.REACT_APP_URL || "";

// Keycloak Environment Variables
const KC_URL =
Expand All @@ -31,6 +34,7 @@ const APP_VERSION =

export const AppConfig = {
apiUrl: `${API_URL}/api/v1/`,
appUrl: APP_URL,
environment: APP_ENVIRONMENT,
version: APP_VERSION,
keycloak: {
Expand Down
1 change: 1 addition & 0 deletions epictrack-web/src/services/userService/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const initKeycloak = async (dispatch: Dispatch<AnyAction>) => {
onLoad: "login-required",
pkceMethod: "S256",
checkLoginIframe: false,
redirectUri: `${AppConfig.appUrl}/track`,
});
if (!authenticated) {
console.warn("not authenticated!");
Expand Down