Closed muratcakir closed 7 months ago
X-Forwarded-Prefix support now implemented via 732c6edc54b0e88188a63183a847744f3e9ebaf1
Sorry to bother again:
On install I get endless redirects to https://my.domain/shop/install.
More debugging: In InstallationStarter.cs
line 50 I get for
context.Request.Path.Value
: /shop/install - correct
context.Request.PathBase.Value
: /shop - correct
but
routeValues.GetControllerName()
returns either null or an empty string.
context.GetRouteData():
{
"DataTokens": {},
"Routers": [],
"Values": {}
}
context.Request.RouteValues
: just empty
No, context.Request.Path.Value
= /shop/install is NOT correct. It should be: /install. Have you defined X-Forwarded-Prefix
header in your proxy config? I need more info.
nginx config:
location ~ ^/shop {
client_max_body_size 10M;
proxy_pass http://127.0.0.1:5000;
proxy_set_header X-Original-URL $request_uri;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Prefix /shop;
proxy_read_timeout 240s;
proxy_send_timeout 240s;
add_header X-Frame-Options "SAMEORIGIN";
}
I also tried to use /shop/ as prefix, same outcome. (just Path was now /shop//install so prefix=/shop should be correct in the config). I also checked if the configuration of the forwarder-middleware was executed: yes
After the shop is installed though, it works just fine, no issues there, just the installer.
Running on a debian 11, nginx 1.18
Hopefully fixed by fd7d76e2e837da087e7cd2a7cba2968bd0608441.
Sadly no.
Since the path is still /shop/install
and not /install
, the path check never fits.
I removed the if clause for testing and directly called /shop/install
. But then I'm presented with a 404, since there is no controller at /shop/install
. The problem doesn't occur on the check for the redirect, but (maybe inside ASPNetCore) with the forwarding/recognition of the path parts itself.
Looking through the aspnetcore middleware, I don't see anything removing the PathBase from the Path. Maybe happening somewhere else.
Another thought: Is there another middleware which needs to be run before the InstallationStarter?
(and just for info, the tests I do are with no additional modules, just bare bones git cloned Smartstore)
Thx :) I'll remove my PR
Should also fix #998, X-Forwarded-Prefix is supported by aspnet core 8