Solving “upstream sent too big header while reading response header from upstream” on Nginx

If you’ve used Nginx, you may have come across this error. 2019/04/12 06:43:24 [error] 11365#0: *257 upstream sent too big header while reading response header from ups tream, client: 127.0.0.1, server: hiroki-example.com, request: “POST /payment HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “hiroki-example.com”, referrer: “http://hiroki-example.com/payment” I’ve seen this many times, but haven’t really tried to understand it deeply. In …

How I set up Nginx on CentOS 7 with PHP 7.2

I’ve just finished setting up Nginx on my brand new PC running on CentOS 7 with PHP7.2. I used to use Ubuntu 16 with PHP7.0 and was quite familiar with the combo. I thought that setting up Nginx on CentOS wouldn’t be that different from doing so on Ubuntu, which wasn’t really true. It took …

How to test React components with form elements

I’ve been teaching myself how to write tests for React app. It seems that Enzyme is the de facto standard for it. Here is what I’ve learned for testing components with form elements (e.g. <input />). Setting up First of all, install the modules. npm install –save enzyme enzyme-adapter-react-16 NOTE: It depends on the version …

How to plan a React.js app development

Draw a component treemap with basic component structures The first step to take is to draw a rough idea as to how the whole app will look like. Typically, you either… get a design plan from your client or designer. Or, develop a design plan by yourself Based on the design, you are going to …

The Abstract Factory (The Factory Pattern – part 3)

1. Definition It provides an interface for creating families of related or dependent objects without specifying their concrete classes. 2. Case study 2.1 The problem You’re creating a car manufacturer simulator, where you can simulate the process of manufacturing cars. As you may know, petrol cars and diesel cars need different parts in their fuel systems, …

The Factory Method Patterm (The Factory Pattern – part 2)

1. Definition Defines an interface for creating an object, but lets subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses. 2.Case study I’m from Japan, where you’ll see different types of Miso (an ingredient of traditional soup) at the supermarket in different regions. For example, in Eastern areas, dark red Miso …

The Strategy Pattern

1. Definition The strategy pattern defines a family of algorithms, encapsulate each one, and make them interchangeable 2. Case study 2.1 The Problem A couple of years ago, you started a restaurant. Your restaurant had become so successful that you started to hire employees. Your employee’s payments were determined by … Wage rate × working hours  Their …

The Decorator Pattern

1. Definition The decorator pattern allows you to attach additional responsibilities to an existing object dynamically. 2. Case study 2.1 The Problem You’re the owner of a pizza store. Because nowadays everyone uses the internet to order pizzas, you decided to have a web application for taking orders from customers. In your app, each pizza was …