How to handle React routes in Apache and Nginx

Apache HTTP ServerUsually little setup of Apache and Nginx is needed so they can handle React routes properly without trying to treat them as real files or directories resulting in 404 Not Found in React.

Here are the snippets of the React routes related settings for Apache and Nginx. Continue reading

Implement Secure Headers in Apache and Nginx

Apache HTTP ServerHTTP security headers are very important part of website security as it protect you against different types of attacks including, XSS, SQL injection, clickjacking, etc.

When you visit any website from your web browser, your browser requests it from the web server where the web site is hosted on. The web server then responds with HTTP Response Headers. These headers contains meta data, status error codes, cache rules and more. It also tell your browser how to behave when handling your website’s content. When you use the web and interacts with websites, your browser stores its information. These headers will help you to outline communication and improve web security. There are six most important security headers that you should be aware of and we recommend implementing if possible.

Be careful, these headers are applying globaly in server if you want to change to specific files please add headers inside a location (nginx) or filesMatch (apache) block. So if you add headers inside any location, files will apply only headers inside location block and global headers will not works for these types of files. Continue reading

Implementing Cache control headers in Nginx and Apache

cache_chart.png

Cache-Control are HTTP cache headers that holds instructions for caching for requests and responses. It is used to defines how a resource is cached, where it’s cached and its maximum age before expiring. When you visit a website, your browser will save images and website data in a store called the cache. When you revisit the same website again, cache-control sets the rules that determine whether your resources loaded from your local cache or if the browser should send a request to the server for fresh resources.

For better understanding of how the browser renders pages quickly using the cache, you need to know about browser caching and HTTP headers. Continue reading

.htaccess: Option FollowSymLinks not allowed here

Apache HTTP ServerI moved from mod_php to fcgi style hosting and got the following in Apache error log when I tried to open one of my websites:

[Tue Nov 08 08:34:08.357359 2022] [core:alert] [pid 19149] [client 95.158.43.63:14405] /home/domain.com/public_html/.htaccess: Option All not allowed here

[Tue Nov 08 08:35:58.058962 2022] [core:alert] [pid 14190] [client 95.158.43.63:46366] /home/domain.com/public_html/.htaccess: Option FollowSymlinks not allowed here

Continue reading

Git Error cloning remote repo code 128 early eof

In case you cannot clone your repository even in shallow mode it means that more memory is needed for git to fetch the files. The git output is similar to:

Again we see the same

fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed Continue reading

mysqldump directly to another server, mysqldump redirect to scp

mysql-logo-imageIt’s not a big deal to perform mysqldump command, get your database as a file and transfer MySQL database to another server by moving the file to another server and import it,

But what if there is no enough space on a disk to store the dump file? In this case it would be great to create MySQL dump file directly on the remote server. And not only you can create dump file directly but even clone a database to remote MySQL! Here I show how to do this.

Continue reading

key type ssh-rsa not in pubkey accepted algorithms

I was running Ubuntu 20.04 happily, and then over the weekend decided to back everything up and install 22.04. I installed my previous keys but I couldn’t login via MobaXTerm remotely as I usually did with 20.04.

I logged in with a console and checked /var/log/auth.log . Here are the messages generated upon my tries to log in:

Continue reading

Jenkins: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed

Again the same git error: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed.

This time – during the execution of Jenkins pipeline:

Continue reading

Using GotoIfTime with Timezones in Asterisk

Asterisk PBXStarting from Asterisk 1.6 GotoIfTime application supports Timezone parameter:

[Syntax]
GotoIfTime(times,weekdays,mdays,months[,timezone]?[labeliftrue][:labeliffalse])

I setup a system that receives calls from people in different timezones so I need to use Timezone parameter in GotoIfTime Asterisk application. Surprisingly I could not find examples on Asterisk’s website so I had to search for some.

There can be two possible formats: you can specify timezone as a shift relative to the time the Asterisk operates in, or you can specify as a path to respective timezone file. Here are the examples: Continue reading

Auto-renew Letsencrypt certificates in Azure Automation Account with managed identity

Recently my Job for renewing Letsencrypt certificates in KeyVault has stopped working. Upon closer look I found that my Run As account certificate expired:

Run-as-account-certificate-is-expired

I navigated to certificate’s properties to renew it as described in Microsoft documentation and thouhgt I have 1 minute work to fix that but no! There is no option to renew it anymore!

Renew-Run-as-certificate-no-option Continue reading

Load more