@@ -5,7 +5,41 @@ server {
55
66 root /usr/share/nginx/html;
77
8- location ~ ^/home/?$ {
8+ # Proxy /home (without trailing slash)
9+ location = /home {
10+ proxy_pass https://lasuite.numerique.gouv.fr/produits/docs;
11+ proxy_ssl_server_name on;
12+ proxy_set_header Host lasuite.numerique.gouv.fr;
13+ proxy_set_header X-Real-IP $remote_addr;
14+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
15+ proxy_set_header X-Forwarded-Proto $scheme;
16+ proxy_set_header Accept-Encoding "";
17+
18+ # Handle redirects
19+ proxy_redirect off;
20+
21+ # Rewrite ALL asset URLs in the HTML to point to lasuite
22+ sub_filter_once off;
23+ sub_filter_types text/html text/css text/javascript application/javascript application/json;
24+
25+ # Rewrite _next and assets paths
26+ sub_filter '="/_next/' '="https://lasuite.numerique.gouv.fr/_next/';
27+ sub_filter '="/assets/' '="https://lasuite.numerique.gouv.fr/assets/';
28+ sub_filter "='/_next/" "='https://lasuite.numerique.gouv.fr/_next/";
29+ sub_filter "='/assets/" "='https://lasuite.numerique.gouv.fr/assets/";
30+ sub_filter 'src="/_next' 'src="https://lasuite.numerique.gouv.fr/_next';
31+ sub_filter 'href="/_next' 'href="https://lasuite.numerique.gouv.fr/_next';
32+ sub_filter 'src="/assets' 'src="https://lasuite.numerique.gouv.fr/assets';
33+ sub_filter 'href="/assets' 'href="https://lasuite.numerique.gouv.fr/assets';
34+
35+ # Fix favicon
36+ sub_filter 'href="/favicon' 'href="https://lasuite.numerique.gouv.fr/favicon';
37+
38+ add_header X-Frame-Options DENY always;
39+ }
40+
41+ # Proxy /home/ (with trailing slash)
42+ location = /home/ {
943 proxy_pass https://lasuite.numerique.gouv.fr/produits/docs;
1044 proxy_ssl_server_name on;
1145 proxy_set_header Host lasuite.numerique.gouv.fr;
0 commit comments