I created a new htaccess generator for angular apps that makes it easier for you to create the optimal htaccess file: https://julianpoemp.github.io/ngx-htaccess-generator/
The goal of this generator is to create the optimal .htaccess file for Angular apps easily. By default the generator creates an .htaccess file that solves the route redirection issue. To make it easier for you I created a kind of interview mode with some questions. As an additional feature the generator supports adding exclusions for example if you have installed a blog in a subdirectory of your web application and more!
The generator 😁: https://julianpoemp.github.io/ngx-htaccess-generator/
The project: https://github.com/julianpoemp/ngx-htaccess-generator
Place for issues and bug reports: https://github.com/julianpoemp/ngx-htaccess-generator/issues
If you have questions you can comment below. Please report bugs here.
Does your routing work in your local environment? (via npm start) If no, there is an issue with Angular routing.- yes it works perfectly, I'm able to access each of the routes while I type in browser address bar
What do the network entries say when trying to reload the app from https://ip:port/sso/callback? Look for the failed request and open its request header. What is the URL of its request header? - the url of request header is https://ip:port/sso/callback, status 404
Your base-href should be correct if your app can be opened on https://ip:port/sso/. I assume that there is any custom server configuration that blocks the .htaccess from working. Since my app is deployed on tomcat and all the build files are placed inside /webapps/sso, I have set the base-href to /sso/. I'm not aware of any custom configuration on server
Are .htaccess files enabled by the server? - not sure. how shall I have to enable this?
Are there any other redirection rules? - no, it's simple angular routes, for login and callback mapped to corresponding components
Are you using more than one .htaccess files? - I created the .htaccess file referring yours and placed it inside /webapps/sso folder with index.html. In .htaccess , RewriteRule is ^ /sso/index.html