<html><head></head><body><div class="yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div>Hello,</div><div><br></div><div>I have a website hosted on a server using nginx behind a nginx reverse proxy but things don't work properly.</div><div><br></div><div>https://mywebsite.org => works</div><div dir="ltr" data-setdir="false"><span>https://mywebsite.org/admin => doestn't work it redirects to https://mywebsite.org<br></span></div><div dir="ltr" data-setdir="false"><span><br></span></div><div dir="ltr" data-setdir="false"><span>On my backend server</span></div><div dir="ltr" data-setdir="false"><div class="ydpfd7fe8f5pasted-link" dir="ltr" data-setdir="false">server {<br>        listen 80;<br><div>        server_name <span>mywebsite.org</span> ;</div>        index index.php;<br><div>        root /var/www/htdocs/sites/<span>mywebsite</span>;</div><div>...</div><div dir="ltr" data-setdir="false"><div dir="ltr" data-setdir="false">        location / {<br>          try_files $uri $uri/ /index.php$is_args$args;<br><br>          location ~ \.php$ {<br><div>              root           /var/www/htdocs/sites/<span><span>mywebsite</span></span>;</div>              try_files $uri =404;<br><div>              fastcgi_pass   unix:/run/php-fpm.<span><span>mywebsite.org</span></span>.sock;</div>              fastcgi_split_path_info ^(.+\.php)(/.+)$;<br>              fastcgi_index  index.php;<br>              fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;<br>              include        fastcgi_params;<br>          }<br><div>        }</div><div>}</div><div><br></div><div dir="ltr" data-setdir="false">On my reverse proxy</div><div dir="ltr" data-setdir="false"><div dir="ltr" data-setdir="false">server {<br>#    listen 80;<br>#    listen [::]:80;<br>    listen 443 ssl;<br>    listen [::]:443 ssl;<br><div dir="ltr" data-setdir="false">    server_name http://<span><span><span>mywebsite.org</span></span></span>;</div><div>...<br></div><div dir="ltr" data-setdir="false">    root /var/www/htdocs/<span><span><span><span>mywebsite</span></span></span></span>;</div><div>    location ^~ / {</div>        proxy_pass              http://10.12.255.23:80;<br>        proxy_redirect          off;<br>        proxy_set_header        Host    $host;<br>        proxy_http_version 1.1;<br>        proxy_set_header  X-Real-IP        $remote_addr;<br>        proxy_set_header  X-Forwarded-Host $host;<br>        proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;<br><div>        proxy_set_header        Referer         "http://<span><span><span>mywebsite.org</span></span></span>/";</div>        proxy_pass_header Set-Cookie;<br>        proxy_set_header  X-Forwarded-Proto $scheme;<br>    }<br></div></div><div dir="ltr" data-setdir="false"><div>}<br></div></div><br></div><div><br></div><div dir="ltr" data-setdir="false">So I can't access <br></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">In the backend server logs I see</div><div dir="ltr" data-setdir="false"><span>[28/Dec/2022:23:54:33 +0100] "GET /admin/ HTTP/1.1" 302 5 "http://<span><span><span><span>mywebsite.org</span></span></span></span>/" ...</span></div><div dir="ltr" data-setdir="false"><span><span class="ydp273dad15pasted-link">[28/Dec/2022:23:54:33 +0100] "GET / HTTP/1.1" 499 0 "http://<span><span><span><span><span><span>mywebsite.org</span></span></span></span></span></span>/" ...</span><br></span></div><div dir="ltr" data-setdir="false"><span><br></span></div><div dir="ltr" data-setdir="false"><span>Regards<br></span></div></div><br></div></div></div></body></html>