Is there a limit on the size of a GET request that Phoenix can handle? I know historically some web servers would only allow something like 256 characters. Is that the case with Phoenix? Or is it configurable? If so, where?
Thanks in advance!
1 Like
I think this is a property of cowboy: max_request_line_length
.
It defaults to 8000 but to change it you can do it like this:
http: [protocol_options: [max_request_line_length: 10_000]]
Reference:
opened 10:23PM - 15 Apr 21 UTC
closed 06:41AM - 19 Apr 21 UTC
### Environment
* Elixir version (elixir -v): 1.11.3
* Phoenix version (mix … deps): 1.5.8
* Operating system: macOS Big Sur 11.1
### Expected behavior
When making a `curl` request with a large query string (>10,000 bytes), the request succeeds.
### Actual behavior
Request fails with:
```
> Host: localhost:4000
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 414 Request-URI Too Long
< connection: close
< content-length: 0
<
* Closing connection 0
```
I thought this may have been happening in `Plug.Parsers.fetch_query_params/x` but (a) that function has a default limit of 1M bytes and (b) I can prove that function is never called.
I made [this example repo](https://github.com/acco/hit414/blob/master/lib/hit414_web/endpoint.ex#L2-L20) where the first plug called in `Endpoint` prints a "HERE" and halts. Alas, the response is the same (414) and there is no indication that this plug is invoked. Therefore, I have reason to suspect the 414 is coming higher up in the chain.
4 Likes