Skip to content
Open
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to
### Added

- ✨(backend) allow to create a new user in a marketing system
- ✨(helm) redirecting system #1697

## [4.1.0] - 2025-12-09

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const Auth = ({ children }: PropsWithChildren) => {
if (config?.FRONTEND_HOMEPAGE_FEATURE_ENABLED) {
if (pathname !== HOME_URL) {
setIsRedirecting(true);
void replace(HOME_URL).then(() => setIsRedirecting(false));
window.location.replace(HOME_URL);
}

return;
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/apps/impress/src/features/auth/conf.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { baseApiUrl } from '@/api';

export const HOME_URL = '/home';
export const HOME_URL = '/home/';
export const LOGIN_URL = `${baseApiUrl()}authenticate/`;
export const LOGOUT_URL = `${baseApiUrl()}logout/`;
export const PATH_AUTH_LOCAL_STORAGE = 'docs-path-auth';
5 changes: 1 addition & 4 deletions src/frontend/apps/impress/src/pages/login/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { useRouter } from 'next/router';

import { HOME_URL } from '@/features/auth';

const Page = () => {
const { replace } = useRouter();
void replace(HOME_URL);
window.location.replace(HOME_URL);
};

export default Page;
8 changes: 8 additions & 0 deletions src/helm/env.d/feature/values.impress.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,14 @@ yProvider:
COLLABORATION_SERVER_SECRET: my-secret
Y_PROVIDER_API_KEY: my-secret

ingressRedirects:
enabled: true
defaultHost: {{ .Values.feature }}-docs.{{ .Values.domain }}
rules:
- name: home
from: /home
to: https://lasuite.numerique.gouv.fr/produits/docs

ingress:
enabled: true
host: {{ .Values.feature }}-docs.{{ .Values.domain }}
Expand Down
49 changes: 49 additions & 0 deletions src/helm/impress/templates/ingress-redirects.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{{- if and .Values.ingress.enabled .Values.ingressRedirects.enabled }}
{{- $fullName := include "impress.fullname" . -}}
{{- $ns := .Release.Namespace -}}
{{- $class := .Values.ingress.className -}}
{{- $defaultHost := .Values.ingressRedirects.defaultHost | default .Values.ingress.host -}}

{{- range $i, $r := .Values.ingressRedirects.rules }}
{{- $host := $r.host | default $defaultHost -}}
{{- $from := $r.from | default "/home" -}}
{{- $to := required (printf "ingressRedirects.rules[%d].to is required" $i) $r.to -}}
{{- $name := printf "%s-redirect-%s" $fullName (replace "/" "-" (trimAll "/" $from)) | trunc 63 | trimSuffix "-" -}}

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $name }}
namespace: {{ $ns }}
annotations:
{{- if or (not $r.code) (eq (toString $r.code) "301") }}
nginx.ingress.kubernetes.io/permanent-redirect: "{{ $to }}"
{{- else }}
nginx.ingress.kubernetes.io/configuration-snippet: |
return {{ $r.code }} {{ $to }};
{{- end }}
spec:
{{- if $class }}
ingressClassName: {{ $class }}
{{- end }}
rules:
- host: {{ $host }}
http:
paths:
- path: {{ $from }}
pathType: Exact
backend:
service:
name: {{ include "impress.frontend.fullname" $ }}
port:
number: {{ $.Values.frontend.service.port }}
- path: {{ printf "%s/" (trimSuffix "/" $from) }}
pathType: Exact
backend:
service:
name: {{ include "impress.frontend.fullname" $ }}
port:
number: {{ $.Values.frontend.service.port }}
---
{{- end }}
{{- end }}
6 changes: 6 additions & 0 deletions src/helm/impress/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ ingressCollaborationWS:
nginx.ingress.kubernetes.io/proxy-send-timeout: "86400"
nginx.ingress.kubernetes.io/upstream-hash-by: $arg_room

ingressRedirects:
enabled: false
namePrefix: impress-redir
defaultHost: impress.example.com
rules: []

## @param ingressCollaborationApi.enabled whether to enable the Ingress or not
## @param ingressCollaborationApi.className IngressClass to use for the Ingress
## @param ingressCollaborationApi.host Host for the Ingress
Expand Down
Loading