Skip to content

Commit 59917b3

Browse files
committed
test4
1 parent 2b38054 commit 59917b3

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/frontend/apps/impress/conf/default.conf

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ server {
1010
}
1111

1212
location ^~ /home/ {
13-
proxy_pass https://lasuite.numerique.gouv.fr/produits/docs;
13+
# Remove /home prefix and proxy to /produits/docs on upstream
14+
rewrite ^/home/(.*) /produits/docs/$1 break;
15+
proxy_pass https://lasuite.numerique.gouv.fr;
1416
proxy_ssl_server_name on;
1517

1618
proxy_set_header Host lasuite.numerique.gouv.fr;
@@ -21,13 +23,19 @@ server {
2123
# Allow sub_filter to see plain text
2224
proxy_set_header Accept-Encoding "";
2325

24-
# Handle redirects from upstream (stay simple: don't rewrite)
25-
proxy_redirect off;
26+
# Handle redirects from upstream
27+
proxy_redirect https://lasuite.numerique.gouv.fr/ /home/;
2628

2729
sub_filter_once off;
2830
sub_filter_types text/html text/css text/javascript application/javascript application/json;
2931

30-
# Rewrite _next and assets paths to the upstream (unchanged)
32+
# Rewrite absolute URLs in content to use local /home prefix
33+
sub_filter 'href="/produits/docs' 'href="/home/';
34+
sub_filter 'src="/produits/docs' 'src="/home/';
35+
sub_filter '"/produits/docs' '"/home/';
36+
sub_filter "'/produits/docs" "'/home/";
37+
38+
# Keep external asset references as absolute URLs to lasuite
3139
sub_filter '="/_next/' '="https://lasuite.numerique.gouv.fr/_next/';
3240
sub_filter '="/assets/' '="https://lasuite.numerique.gouv.fr/assets/';
3341
sub_filter "='/_next/" "='https://lasuite.numerique.gouv.fr/_next/";
@@ -36,9 +44,12 @@ server {
3644
sub_filter 'href="/_next' 'href="https://lasuite.numerique.gouv.fr/_next';
3745
sub_filter 'src="/assets' 'src="https://lasuite.numerique.gouv.fr/assets';
3846
sub_filter 'href="/assets' 'href="https://lasuite.numerique.gouv.fr/assets';
39-
4047
sub_filter 'href="/favicon' 'href="https://lasuite.numerique.gouv.fr/favicon';
4148

49+
# Rewrite dynamically constructed URLs in JavaScript
50+
sub_filter '/_next/' 'https://lasuite.numerique.gouv.fr/_next/';
51+
sub_filter '/assets/' 'https://lasuite.numerique.gouv.fr/assets/';
52+
4253
add_header X-Frame-Options DENY always;
4354
}
4455

0 commit comments

Comments
 (0)