While creating a simple reverse proxy, I'm struggling with a path-related issue that I cannot solve.
From what I have read, to achieve this it should be as easy as adding the following directives in /etc/apache2/sites-available/000-default.conf within the <VirtualHost> tag:
ProxyPreserveHost On
ProxyPass "/path/" "http://xxx.xxx.xxx.xxx:pppp/"
ProxyPassReverse "/path/" "http://xxx.xxx.xxx.xxx:pppp/"
The problem is with requests of (sub-)paths with no trailing slashes. For example:
What I'm doing wrong?
Thanks!
I faced the same problem. Managed to fix it by adding
<Location /mypath>
ProxyPreserveHost On
ProxyPass http://127.0.0.1:5000/mypath
ProxyPassReverse http://127.0.0.1:5000/mypath
</Location>
Daemon that runs ASP.NET Core app contains pathBase parameter:
[Unit]
Description=My Web App
[Service]
WorkingDirectory=/opt/sites/MyWebApp
ExecStart=/usr/bin/dotnet /opt/sites/MyWebApp/MyWebApp.dll --pathBase=/mypath --urls=http://0.0.0.0:5000
Restart=always
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=trialkeygen
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With