How to fix trailing slashes causing a https url to redirect to http
I am following the steps in custom-app.md to host our custom apps
When a trailing slash is added to a https url it is getting redirected to a http url with a port name appended to the domain name which causes a broken page
For example when a user visits https://oursubdomain.ourdomain.com/app/home it works But when a user visits https://oursubdomain.ourdomain.com/app/home/ [note the trailing slash] it is getting redirected to http://oursubdomain.ourdomain.com:8080/app/home [note no https and 8080 is getting appended]
Please help me to fix the issue
Issue related to Ingress Nginx: https://github.com/kubernetes/ingress-nginx/issues/5997
Fixed by making changes to resources/nginx-template.conf
I changed this
rewrite ^(.+)/$ $1 permanent;
rewrite ^(.+)/index\.html$ $1 permanent;
rewrite ^(.+)\.html$ $1 permanent;
to
rewrite ^(.+)/$ "https://$host$1" permanent;
rewrite ^(.+)/index\.html$ "https://$host$1" permanent;
rewrite ^(.+)\.html$ "https://$host$1" permanent;
don't know if it is a correct solution.
there is one more issue due to the old redirect configuration, early users who visited the site with a trailing / like https://<host><uri>/ were redirected to http://<host><uri>:8080 as it is a permanent redirect chrome has cached it
because of this now when those users visit a url they previously visted that contain a trailing /. chrome uses the cache and they end up with the http url with port
The users have to clear the browser cache manually to fix this
It will be helpful if some one provides a better solution to clear the redirect cache without user involvement
This issue has been automatically marked as stale. You have a week to explain why you believe this is an error.