I've made an asp.net core application and I'm trying to host it in Apache with reverse proxy. The app uses cookie authentication:
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
AuthenticationScheme = "CookieAuthentication",
LoginPath = new PathString("/Account/Login/"),
AccessDeniedPath = new PathString("/Account/Forbidden/"),
AutomaticAuthenticate = true,
AutomaticChallenge = true
});
In httpd.conf I would like to use one SSL only host with custom port which serves content from Kestrel.
Listen 34567
<VirtualHost *:34567>
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
SSLEngine on
SSLProtocol all -SSLv3
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:!RC4+RSA:+HIGH:+MEDIUM:!LOW:!RC4
SSLCertificateFile certs/server.crt
SSLCertificateKeyFile certs/server.key
</VirtualHost>
When I use url https://testserver1:34567 it redirects to http://testserver1:34567/Account/Login/?ReturnUrl=%2F which of course gives a Bad Request. If I correct the url by changing it to https, everything works fine afterwards.
How can I make it so that it always redirects to a https url?