Umbraco 13 Generates HTTP URLs Instead of HTTPS on Kubernetes Deployment
Context:
Umbraco Version: 13
Environment: Deployed on Kubernetes
Ingress Controller: Nginx
Reverse Proxy: Yes, using HTTPS termination at the ingress level
Kubernetes Cluster Configuration:
HTTPS works fine when accessing the site.
Umbraco correctly redirects all requests to HTTPS.
Issue: Umbraco-generated URLs (e.g., via Model.Url(mode: UrlMode.Absolute)) are still being returned with http:// instead of https://.
Actions Taken So Far:
Configured UmbracoApplicationUrl:
Added the following setting in appsettings.json to explicitly set the base URL:
json
{
"Umbraco": {
"CMS": {
"WebRouting": {
"UmbracoApplicationUrl": "https://mydomain.com"
}
}
}
}
This did not resolve the issue.
Nginx Ingress Annotations:
Ensured that the ingress resource has the necessary annotations:
yaml
annotations:
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/x-forwarded-proto: "https"
The ingress correctly handles SSL and redirects all traffic to HTTPS.
Expected Behavior:
All Umbraco-generated URLs (e.g., via Model.Url(mode: UrlMode.Absolute)) should use the https:// scheme when accessed via HTTPS.
Actual Behavior:
URLs generated by Umbraco are still using the http:// scheme, even though the site is running over HTTPS, and all requests are correctly redirected to HTTPS.
Additional Information:
Platform: Kubernetes cluster with Nginx ingress (please replace with your ingress if different).
SSL Termination: Handled at the ingress level with valid TLS certificates.
Ingress Configuration:
Using a standard Kubernetes ingress resource with HTTPS enforced via annotations.
Please advise on how to correctly configure Umbraco to generate HTTPS URLs in this environment.
The issue have been fixed by adding app.UseForwardedHeaders(); app.UseHttpsRedirection(); to the top of the function Configure(IApplicationBuilder app, IWebHostEnvironment env)
And adding below code:
public void ConfigureServices(IServiceCollection services){
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
});
Umbraco 13 Generates HTTP URLs Instead of HTTPS on Kubernetes Deployment
Context:
Model.Url(mode: UrlMode.Absolute)
) are still being returned withhttp://
instead ofhttps://
.Actions Taken So Far:
Configured
UmbracoApplicationUrl
: Added the following setting inappsettings.json
to explicitly set the base URL:json { "Umbraco": { "CMS": { "WebRouting": { "UmbracoApplicationUrl": "https://mydomain.com" } } } }
This did not resolve the issue.Nginx Ingress Annotations: Ensured that the ingress resource has the necessary annotations:
yaml annotations: nginx.ingress.kubernetes.io/force-ssl-redirect: "true" nginx.ingress.kubernetes.io/x-forwarded-proto: "https"
The ingress correctly handles SSL and redirects all traffic to HTTPS.Expected Behavior:
Model.Url(mode: UrlMode.Absolute)
) should use thehttps://
scheme when accessed via HTTPS.Actual Behavior:
http://
scheme, even though the site is running over HTTPS, and all requests are correctly redirected to HTTPS.Additional Information:
Please advise on how to correctly configure Umbraco to generate HTTPS URLs in this environment.
The issue have been fixed by adding
app.UseForwardedHeaders(); app.UseHttpsRedirection();
to the top of the functionConfigure(IApplicationBuilder app, IWebHostEnvironment env)
And adding below code:
public void ConfigureServices(IServiceCollection services){ services.Configure<ForwardedHeadersOptions>(options => { options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; options.KnownNetworks.Clear(); options.KnownProxies.Clear(); });
is working on a reply...