teleren/devto huggingface dataset:
How to Fix 'Client Intended to Send Too Large Body' Nginx 413 Error
Tags: nginx, webserver
Published: 2023-01-20 01:21:18

---
title: How to Fix 'Client Intended to Send Too Large Body' Nginx 413 Error
published: true
date: 2022-09-23 09:31:26 UTC
tags: 
- Nginx
- WebServer
canonical_url: https://fajarwz.com/blog/how-to-fix-client-intended-to-send-too-large-body-nginx-413-error/
---

![Nginx 413 illustration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/su2mcjxoe83v9obrvqul.png)

This can happen when a user upload a very large sized file to our app that served with Nginx. Maybe the user see the following error

![Nginx 413](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kbrnywv9eh0legesw256.jpeg)

And when we search for an error log for this in Nginx error log in - for example - for CentOS it is located at `/var/log/nginx/error.log`, we found `Client Intended to Send Too Large Body: xxxxxx bytes` error.

Let's fix this by adding a rule in our Nginx config file. We need to add `client_max_body_size` rule.

## Setting for Spesific Site Only

If you want this rule for spesific site only, set this inside your spesific site config that located at `/etc/nginx/sites-available/mywebsite.com.conf`

For example We can use `nano` to open the config file

```
sudo nano /etc/nginx/sites-available/mywebsite.com.conf
```

Then insert the following rule

```
server {
    ...
    # set the maximum upload to 20MB
    client_max_body_size 20M;
    ...
}
```

## Setting for All Server Blocks

If we want the rule to affects all server blocks, set it inside `/etc/nginx/nginx.conf`. 

```
http {
    ...
    # set the maximum upload to 20MB
    client_max_body_size 20M;
    ...
}
```

Note: Setting size to 0 disables checking of client request body size.

## Check Nginx Configuration And Restart

Next, check our configuration by running 

```
sudo nginx -t
```

If it says "syntax is ok" then we are ready to restart our Nginx.

```
sudo systemctl restart nginx
```

## Conclusion

That's it, our app should be able to receive files with size under 20MB with this `client_max_body_size` rule in Nginx.

## Read Also
- [Create Login With Google OAuth Using Laravel Socialite](https://fajarwz.com/blog/create-login-with-google-oauth-using-laravel-socialite/)
- [Create Reusable Query With Laravel Query Scope](https://fajarwz.com/blog/create-reusable-query-with-laravel-query-scope/)
- [Laravel Rest API Authentication Using JWT Tutorial](https://fajarwz.com/blog/laravel-rest-api-authentication-using-jwt-tutorial/)

## Reference
[How to Limit File Upload Size in Nginx](https://www.tecmint.com/limit-file-upload-size-in-nginx/)
High Intensity
Published: 2022-09-23 09:29:26

So recently i found this podcast called broken by concepts that related to league of legends ranked climbing methodology, i they came up with a lot of great concepts and idea.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ax3o3wj6r2lbogy6nd9n.png)

the concept of being expert at something can really apply to programming in general, and probably that’s why im in love with programming, is not the end goal for me but the process of learning and get better everyday.

Like michael jordan and what makes him one of the best player of all time, we need to see what he did everyday to reach the top 0.01%, just a little talk to keep my medium update.
Getting started with wolfssl
Tags: c
Published: 2022-09-23 09:09:05

First, clone the repository. This is going to take some time.

```
git clone https://github.com/wolfssl/wolfssl
Cloning into 'wolfssl'...

// will take a few minutes
```

Enter the directory and run `autogen`

```
$ cd autogen.sh
$ sh autogen.sh
glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
glibtoolize: copying file 'build-aux/ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
glibtoolize: copying file 'm4/libtool.m4'
glibtoolize: copying file 'm4/ltoptions.m4'
glibtoolize: copying file 'm4/ltsugar.m4'
glibtoolize: copying file 'm4/ltversion.m4'
glibtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:22: installing 'build-aux/compile'
configure.ac:24: installing 'build-aux/config.guess'
configure.ac:24: installing 'build-aux/config.sub'
configure.ac:28: installing 'build-aux/install-sh'
configure.ac:28: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
```

After finishing, run the following.

```
$ ./configure
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
....
   * IoT-Safe:                   no
   * IoT-Safe HWRNG:             no
   * NXP SE050:                  no
   * PSA:                        no

---

$ make check
/Applications/Xcode.app/Contents/Developer/usr/bin/make -j17  check-recursive
make[2]: warning: -jN forced in submake: disabling jobserver mode.
  CC       wolfcrypt/src/src_libwolfssl_la-hmac.lo
  CC       wolfcrypt/benchmark/benchmark.o
....
/Applications/Xcode.app/Contents/Developer/usr/bin/make -j17  check-TESTS
make[3]: warning: -jN forced in submake: disabling jobserver mode.
make[4]: warning: -jN forced in submake: disabling jobserver mode.
SKIP: scripts/openssl.test
SKIP: scripts/external.test
PASS: testsuite/testsuite.test
PASS: scripts/resume.test
PASS: scripts/google.test
PASS: scripts/tls13.test
PASS: scripts/unit.test
============================================================================
Testsuite summary for wolfssl 5.5.0
============================================================================
# TOTAL: 7
# PASS:  5
# SKIP:  2
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
```

Finally, install the library.

```
sudo make install
Password:
```

We can try out sample samples as below.

```
// In one window
$ ./examples/server/server

// In another
./examples/client/client
```

Using software like Wireshark, we can see that the server and the client are talking to each other using encrypted data.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x3xav05cpon7k5392y8s.png)
This Week In Python
Tags: python
Published: 2022-09-23 09:28:33


**Fri, September 23, 2022**


This Week in Python is a concise reading list about what happened in the past week in the Python universe. 


## Python Articles


- [Build an Alexa- or Siri-Equivalent Bot in Python Using OpenAI ](https://betterprogramming.pub/building-an-alexa-or-siri-equivalent-bot-in-python-ea07ed001445)
- [Lazy imports for Python](https://lwn.net/Articles/907226/)
- [Python dictionary operations you should know](https://medium.com/@dreamferus/python-dictionary-operations-you-should-know-bb91a77bd97a)
- [The maze of Python dependency management](https://blog.frankel.ch/maze-python-dependency-management/)
- [Metaprogramming in Python](https://developer.ibm.com/tutorials/ba-metaprogramming-python/)

## Projects


- [rocketry](https://github.com/Miksus/rocketry) – Modern scheduling library for Python
- [django-formset](https://github.com/jrief/django-formset) – Building beautiful Forms in Django with a contemporary User eXperience has never been easier
- [envd](https://github.com/tensorchord/envd) – Development environment for AI/ML, based on buildkit
- [django-imagekit](https://github.com/matthewwithanm/django-imagekit) – Automated image processing for Django
- [slack-machine ](https://github.com/DonDebonair/slack-machine) – A simple, yet powerful and extendable Slack bot
Good Developer vs Bad Developer
Tags: beginners, career, webdev, productivity
Published: 2022-09-23 09:25:45

| **Good Developer**                                              | **Bad Developer**                                                    |
| --------------------------------------------------------------- | -------------------------------------------------------------------- |
| 1. Focuses on solving problems using right technologies         | 1. Focuses on the following the latest technologies.                 |
| 2. Eager to learn new things                                    | 2. Attached to their favorite technology                             |
| 3. Write the minimum amount of code possible to solve a problem | 3. Believes their worth is related to the amount of code they write. |
| 4. Disciplined about making progress.                           | 4. Works whenever “he is in the mood”                                |
| 5. Understand the value of code reviews and pair programming    | 5. Get offended when someone critiques their work.                   |
| 6. Married to the users’ problems                               | 6. Married to his own solutions                                      |
| 7. Open to criticism                                            | 7. Run from critique.                                                |

---

**_NOTE:_** If you found this help. Like and share. Thanks, Happy Learning!

---

### Let's connect 💜

You can follow me on [Twitter](https://twitter.com/MrDanishSaleem), [Instagram](https://www.instagram.com/mrdanishsaleem/), [LinkedIn](https://www.linkedin.com/in/mrdanishsaleem/) & [GitHub](https://github.com/mrdanishsaleem/)

### Support Me

If you like this post. Kindly support me by [Buying Me a Coffee](https://www.buymeacoffee.com/mrdanishsaleem)
How to optimize images for website?
Tags: javascript, webdev, tutorial, react
Published: 2022-09-23 09:18:34

Images are the core and heaviest component of the website. In your carrier, in web development, you might have encountered the following report in the [Lighthouse test](https://web.dev/measure):
![Lighthouse Report](https://cdn.hashnode.com/res/hashnode/image/upload/v1663913292145/kkvqcRpj2.webp)

As a result, in this article, I will show you an easy and simple way to optimize images for your website and increase its performance.

### Optimizing Images
- **Step 1: Compress the image**<br  />
Compression plays an important role in website optimization. It can significantly reduce file size. The following illustration shows the end result:
![Image Compression Result](https://cdn.hashnode.com/res/hashnode/image/upload/v1663914174342/Z2MrKrjhc.webp)
You can use any online tool to compress the image. I'm using [squoosh.app](https://squoosh.app/) in this case.

- **Step 2: Convert image to webp**<br />
WebP is a modern image format that provides superior lossless and lossy compression for images on the web.
    
    > According to Google Developers, WebP lossless images are 26% smaller in size compared to PNGs.
    
    Again, you can convert images to webp using any online tool. [Convertio](https://convertio.co/) is what I'm using in this case.
    
- **Step: 3 Image CDN (optional)**<br />
Image content delivery networks (CDNs) excel at image optimization. Switching to an image CDN can result in a 40-80% reduction in image file size.
    
    Check the following image, Image CDNs URL to indicate Image optimization:
    ![Image CDN URL](https://cdn.hashnode.com/res/hashnode/image/upload/v1663915371853/eJzgsjXSd.png)
  <center>Image credit: [web.dev](https://web.dev/)</center>
    Some services like:
    - Cloudinary
    - Cloudflare Images
    - Netlify CDN
  
    They provide Image CDN to optimize images.

So that concludes this article; stay tuned for the next!



### Thanks for reading

Follow me on [Twitter](https://www.dhairyashah.dev/twitter)

Thanks for reading!
Win Nintendo Switch and more at Extract Summit Coding Contest
Published: 2022-09-23 09:04:44

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6v4sokt0a5qw0ylfrdu6.gif)

Hola,

Do you have what it takes to be called a web scraping whizz?
If so, then we want you. Zyte is hosting the Extract Summit Coding Contest where you get to win prizes like Nintendo Switch, Marshall Wireless headphones and Echo Show!

All you need to do is crawl and scrape all expected items from a given website and stand a chance to win bragging rights plus awesome prizes. And the best part is it's FREE
Seems exciting? Then register now at:[https://bit.ly/3RS0TZO](https://bit.ly/3RS0TZO)
Complete Roadmap to Learn Flutter App Development and Become a Flutter Developer
Tags: programming, flutter, beginners, codenewbie
Published: 2022-09-23 09:04:05

Learning any framework, language, or technology requires patience and a huge amount of time. Don’t lose any hope and stop in the middle. The most important thing is don’t compare your journey with others!

## What is Flutter?
[Flutter](https://radixweb.com/flutter-development) is a UI toolkit created by Google for developing cross-platform mobile applications for multiple devices from a single code base. Flutter uses Dart as a primary language, which allows you to build cross-platform mobile apps for Android, iOS, Windows, Linux, and Fuchsia platforms.
If you are planning to know more about Flutter and Flutter development, then refer to this interesting page - [Flutter App Development](https://radixweb.com/services/flutter-app-development)
And if you plan to become a Pro Flutter App Developer, do consider this below Roadmap image.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8cgtvmplrrjyhzqted81.jpeg)
(Source- Google)
Qdrant supports ARM architecture!
Published: 2022-09-23 08:57:54

The processor architecture is a thing that the end-user typically does not care much about, as long as all the applications they use run smoothly. If you use a PC then chances are you have an x86-based device, while your smartphone rather runs on an ARM processor. In 2020 Apple introduced their ARM-based M1 chip which is used in modern Mac devices, including notebooks. The main differences between those two architectures are the set of supported instructions and energy consumption. ARM’s processors have a way better energy efficiency and are cheaper than their x86 counterparts. That’s why they became available as an affordable alternative in the hosting providers, including the cloud.

Read the full article by Kacper Łukawski (Developer Advocate at Qdrant) at this [**link**](https://blog.qdrant.tech/qdrant-supports-arm-architecture-363e92aa5026).

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/20t3xdxgkmvz9fhn7dk7.png)
Web hosting issues || GitHub Page is not showing up on website?
Tags: github, githubpage, javascript, css
Published: 2022-09-23 08:41:50

I have created one repository on GitHub and hosted it with the help of the GitHub page. My issue is that if I have put all code (CSS, JavaScript code) in HTML then it works, but if I have created another folder of CSS and JavaScript, and saved the path in HTML, then it's not working. I don't understand why.

For example, you create one simple hello world website and try code from this condition.

Repository link: [Aj Zero Coding](https://github.com/Ajay-Dhangar/Aj-Zero-Coding-2.o.github.io)

Website link: [Aj Zero Coding](https://ajay-dhangar.github.io/Aj-Zero-Coding-2.o.github.io/)

Output link: [Project](https://github.com/Ajay-Dhangar/Aj-Zero-Coding-2.o.github.io/wiki) (I want this output).
10 Great Free APIs for Front-End Developers
Published: 2022-09-23 08:36:53

# Introduction
So you are front-end developer and and want to build interactive applications that interacts with the API but you don't have API to do so. No worries in this post I'll cover 10 amazing free apis that you can use to build awesome projects.

## 1. Web Search API
If you want to build search engine like google or implement simple search engine widget then Web Search API is great tool to do so. It returns billions of webpages, images, news with a just single API call. 
[Web Search](https://rapidapi.com/contextualwebsearch/api/web-search)

## 2. Open Weather Map API
Open Weather Map is free API which gives data on the latest weather around the world. All you've to do is provide city name or country name and it returns weather details for that specific area
[Open Weather Map](https://openweathermap.org/api)

## 3. IMDB API
If you want to build movie app then IMDB API is another great API as it returns data for queried films, actors, tv-series, trailers, movie ratins and more.
[IMDB](https://imdb-api.com/API)

## 4. News API
News API amazing free API that provides you with the data on the worldwide news. So if you are building News APP then you should definitely have a look at this API
[News](https://newsapi.org/)

## 5. The Guardian API
If you need the data that's generated by The Guardian API then you can use their free public service API
[The Guardian](https://open-platform.theguardian.com/access/)

## 6. Instagram API
If you are building the clone of the Instagram or need real time data from Instagram in your APP then you can use this amazing free API that provides real-time data from Instagram
[Instagram](https://rapidapi.com/Prasadbro/api/instagram47)

## 7. API-Football
If you want to build Football results app then API-Football is the  API for you as it provides +940 football leagues & cups. Livescore on every 15 seconds, live & pre-match odds, events, line-ups, coachs, players, top scorers, standings, statistics, transfers, predictions.
[API-Football](https://rapidapi.com/api-sports/api/api-football)

## 8. Meme Generator API
Meme Generator API is a simple meme generator that generates memes by choosing a preloaded image, and short top and bottom text sentences. Memes are served in the JPEG image file format
[Meme Generator](https://rapidapi.com/meme-generator-api-meme-generator-api-default/api/meme-generator/)

## 9. Words API
Words API lets you retrieve information about English words, including definitions, synonyms, rhymes, pronunciation, syllables, and frequency of usage. It also can tell you about relationships between words, for instance that “math” has categories like “algebra” and “geometry”, or that a “finger” is part of a “hand”.
[Words](https://rapidapi.com/dpventures/api/wordsapi/)

## 10. API-NBA
If you are into basketball then API-NBA covers you as it provides with the all NBA Stats DATA, Games, Livescore, Standings, Players, Statistics and a lot more
[API-NBA](https://rapidapi.com/api-sports/api/api-nba/)
Test dynamic class names from CSS Modules in Cypress
Tags: javascript, cypress, testing
Published: 2022-09-23 08:11:29

Sometimes you want to test that a element in your code get the correct CSS class. I use CSS Modules so it's impossible to know the exact class name when you writing the test.

Sometimes i have worked around this issue by asserting directly against the actual css i.e 

```javascript
    cy.findByText(/my text/gi)
      .should("have.css", "background-color", "rgb(60, 99, 132)")
      .should("have.attr", "href")
      .and("include", "about"); 
```

This works, but usually it's not really the color your after but if for example a element is active or focused or something.

And today i did some digging and finally found how to do this. Really simple tbh.

```javascript
    cy.findByText(/my text/gi)
      .invoke("attr", "class")
      .should("contain", "selected");

    cy.findByText(/my text/gi)
      .should("have.attr", "href")
      .and("include", "about");
```
 
Note that i use [Testing Library for Cypress](https://testing-library.com/docs/cypress-testing-library/intro/) to get that "findByText" method. But this should also work for regular cypress "cy.get" commands.

Reference: [Github Issue Comment](https://github.com/cypress-io/cypress/issues/1212#issuecomment-403351091)
apply search unicode by unaccent
Tags: python, postgres, search
Published: 2022-09-23 08:04:52

Step 1 : Add extension unaccent for Postgres by run query > create extension unaccent 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jwdualliir8j0f4l7zwb.png)

Step 2 : Python/INSTALLED_APPS add > 'django.contrib.postgres'
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sv6v9cendau3f6iykrjj.png)

Step 3 : Using unaccent in filter , 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n1gw6liug7cvbrigifg0.png)

Warning 1: unaccent lookups should perform fine in most use cases. However, queries using this filter will generally perform full table scans, which can be slow on large tables. In those cases, using dedicated full text indexing tools might be appropriate.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i36g4da8i5t4iq2ivxon.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57vhdm0xuhd3clran2zl.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k996sg4i8jgk089e70gh.png)
A Quick 10-Second Programming Joke For Today
Tags: jokes, dailydeveloperjokes
Published: 2022-09-23 08:00:08

---
title: "A Quick 10-Second Programming Joke For Today"
description: "Check out today's daily developer joke! (a project by Fred Adams at xtrp.io)"
series: "Daily Developer Jokes"
published: true
tags: #jokes, #dailydeveloperjokes
---

Hi there! Here's today's Daily Developer Joke. We hope you enjoy it; it's a good one.

![Joke Image](https://private.xtrp.io/projects/DailyDeveloperJokes/public_image_server/images/5e1258e3bbae5.png)

---

For more jokes, and to submit your own joke to get featured, check out the [Daily Developer Jokes Website](https://dailydeveloperjokes.github.io/). We're also open sourced, so feel free to view [our GitHub Profile](https://github.com/dailydeveloperjokes).

### Leave this post a ❤️ if you liked today's joke, and stay tuned for tomorrow's joke too!

_This joke comes from [Dad-Jokes GitHub Repo by Wes Bos](https://github.com/wesbos/dad-jokes) (thank you!), whose owner has given me permission to use this joke with credit._

<!--
Joke text:
___Q:___ Why don't bachelors like Git?

___A:___ Because they are afraid to commit.
 -->
How to view data on a NEAR protocol contract for Free?
Tags: 100daysofcode, productivity, javascript, entrepreneur
Published: 2022-09-23 07:56:49

There are two ways to view and interact with data on the NEAR blockchain.

### 1. Change Methods

Change methods execute functions on smart contracts. These then get proved on the blockchain and they allow us to change the state of a smart contract.

ex: Wanting to transfer an NFT from one owner to another.

Data/State has to be updated, which means there's a fee to execute this as an "Attached Deposit".

[**DOCS**](https://docs.near.org/tools/near-api-js/quick-reference#call-contract)

```js
await contract.method_name({
 callbackUrl: "https://example.com/callback", // callbackUrl after the transaction approved (optional)
 meta: "some info", // meta information NEAR Wallet will send back to the application. `meta` will be attached to the `callbackUrl` as a url search param
 args: {
 arg_name: "value" // argument name and value - pass empty object if no args required
 },
 gas: 300000000000000, // attached GAS (optional)
 amount: 1000000000000000000000000 // attached deposit in yoctoNEAR (optional)
});
```

### 2. View Methods - FREE

These are read-only methods that also live in smart contracts but don't change the state or data on chain.

ex: Viewing the NFT an owner has from a specific collection.

This is just returning existing state in read only and is free to call and view.

[**DOCS**](https://docs.near.org/tools/near-api-js/quick-reference#call-contract)

```js
const response = await contract.view_method_name({ arg_name: "arg_value" });
console.log(response);
```