Resolved: Fix SSL renewal issue on Gitlab Server

PROBLEM : I had hosted a gitlab server on Azure and it was not getting autorenewed. SOLUTION :  1. Check the current SSL cert path: sudo grep -n "ssl_certificate" /var/opt/gitlab/nginx/conf/gitlab-http.conf OR sudo grep -n "ssl_certificate" /etc/gitlab/gitlab.rb  You are likely to see something like this: nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.example.com.crt" nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.example.com.key"  2. In my case, I was using gitlab let'sencrypt. So, I installed certbot. sudo apt update && sudo apt install certbot -y  3. Obtain Fresh Certificate sudo gitlab-ctl stop nginx sudo certbot certonly --standalone -d gitlab.yourdomain.com sudo gitlab-ctl start nginx 4. Configure Gitlab to use new cert external_url "https://gitlab.yourdomain.com" letsencrypt['enable'] = false nginx['s...

Resolved: Getting 404 on refresh in angular or react application

 PROBLEM: If you are working with a single page application (SPA) say an application built with Angular or React, you may get a 404 when you hit a refresh on a specific route and you host your application on Apache Server.

Solution

Simply add a .htaccess file in the root directory of your application or website and your problem should be solved

 

RewriteEngine on
#RewriteCond %{HTTPS} !on


RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteRule ^(.*) /index.html [NC,L]


# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}/index.html
# RewriteRule ^([^/]+)/?$ index.html [L]
# RewriteCond %{REQUEST_URI} !^/index.html$
# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}\.(php|html)$ /index.html [L,R=302]