M
M
Maxim Ulyanov2020-05-30 17:59:55
Nginx
Maxim Ulyanov, 2020-05-30 17:59:55

How to overcome 431 error in nuxt application?

Faced the following problem: we are developing an online store with the team, we launched the application in production; marketers launch all sorts of advertising campaigns and drive traffic to the application. All these advertising services slip wild utm tags into query parameters and set hellion cookies. Our application, of course, is behind nginx , and nginx has raised the limits for headers to horse sizes, that's it. But the node server itself has by default limits on headers of 8KB ( 16KB, depends on the version of the node ). And the application falls off with the 431st error . At first I sinned on nging . And then on the LAN reproduced the error by generating several hundred cookies. Thought maybe PM2does some crap, but no, this is a node, there is no doubt. And now the question has risen sharply: should I write my node server under nuxt with a builder and flexibly configure everything through it, or is there some way to avoid this and fix the problem using nuxt tools . It's always better to have less code than more, since we still have to maintain all this.)

And one more thing: the situation is slightly complicated by the fact that we use the nuxt + typescript bundle . That is, some classic solutions do not go to express .

I know that there is a console parameter --max-http-header-size in the node , but just as I understand it, you can’t use it with nuxt . You just need to run something like this:

node --max-http-header-size=1500 server

In general, some kind of stupor so far. I would be grateful for any hints and help in this matter!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2020-05-30
@maximulyanov

To pass command line arguments to node , you can simply set the NODE_OPTIONS environment variable .
But the right decision is not to increase the limits, but to figure out what the hell your headline is so fat. Thick header - junk traffic - slowdown.
Ad networks should not write anything special to your cookies and utm parameters should not fly inside your site at all.
Take a request dump (from the console or from the site) and see what kind of garbage is there, where it came from and how to configure the culprit so that he does not shove this garbage there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question