AWS API Gateway Console provides a simple mechanism to enable CORS and handle Cross-Origin browser requests to REST Apis/ Services. You may select any "resource" in the API Management console and select "Enable CORS" from the "Actions" Dropdown. You may expect this feature would be simple click and forget solution but you might still encounter CORS issues when you make API request calls from your favourite UI frameworks such as React, Angular, Vue and even plain vanilla javascript. You may end up tinkering your backend service irrespective of the technology used; Lambda (AWS), Springboot (Java), Flask, Express (nodejs) ...never ending list of REST API platforms. Either you end up lucky solving the issue or left searching for answers. You might encounter errors such as - Origin http://[yourdomain].com is not allowed by Access-Control-Allow-Origin. Origin http://localhost:4200 is not allowed by Access-Control-Allow-Origin. Reason: CORS header 'Acce
Often you may find yourselves in the middle of searching for a keyword in your log files. On the linux environment , you will easily find by using the command grep 'your keyword' filename.log Sometime you may want to know what happens before and after the occurrence of your keyword. In the example below I tried to look for an exception using grep command. The output alone is not really helpful to identify the problem that I'm looking for. We need to understand what happened before and after the exception that occurred. The first step is to get the line number of the first occurrence of this error. Let's use the command with grep -n command We can now see the line numbers; 2449 and 2515. The next step is to find out the content of the log few lines adjacent to line 2449 in this example. The following command gives the desired result that is connect of the log file between the lines shown in the example below. sed -n '2440,2460 { p; }' < nohup.