-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP 431 errors on very large diagrams for svg generation #12
Comments
I'm not really sure if a code change is desirable here; the public mermaid.ink service probably wants to keep |
(attached generated file in case someone wanted to give it a try: poison.mermaid.zip) mermaid.ink |
Appreciate your thorough investigation! Yes, I would like to keep I'll mention it in the readme! |
I'm thinking to provide another way to use marmaid.ink for large diagram, one of ways could support external URL like gist, for example:
when you access |
That's an interesting idea! My automation is trapped in a corporate network, but that might be easier for a lot of people. We could generalize that to fetching from anywhere (e.g. For gists, it'd be nice to have as few constraints as possible for the consumers. What do you think about iterating through all the files in the gist, and rendering the first one that parses successfully? I figure the most common use case would be a gist with one file that is mermaid graph, and working without requiring a specific name would be nice for consumers. Another thought: what if we also supported |
Yes, I prefer mermaid.ink itself as a public service only supports specific external services.
I'm a bit concerned for iterating through all the files in the gist, if something goes wrong, it might be problematic for the service. If the most common use case would be a gist with one file, how about we just take the first content of the gist and render that one?
Supporting |
This issue could be mitigated by #32 |
I was wondering how large diagrams mermaid.ink could handle (to see if I can use it on my website, or if I would run into this issue), so I did some tests. Using the test script in first post, I found that it works with 325 nodes, but not with 375 nodes. To get a better understanding of how large the code/how big the diagram is with 325 nodes, see: I don't think this will ever be a problem for me. Thanks for a very useful service! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
With very large diagrams I'm getting back "431 Request Header Fields Too Large". I have some code generating diagrams from various data sources, and am running into this pathological case.
Reproduction case
Expected behavior: the same graph is rendered
Actual behavior: 431 Request Header Fields Too Large
Analysis
This 431 response is being returned from inside node's
http
module. Changes made in nodejs to resolve Denial of Service with large HTTP headers (CVE-2018-12121) introduced the--max-http-header-size
setting, which defaults to 16KB. If the url is too big then the underlying http server rejects the HTTP request with a 431.Workarounds
--max-http-header-size
to the start script in package.json"start": "node --max-http-header-size=102400000 src/index.js"
NODE_OPTIONS
to increase--max-http-header-size
docker run --rm -it -e 'NODE_OPTIONS="--max-http-header-size=102400000"' -p 3000:3000 jihchi/mermaid.ink
The text was updated successfully, but these errors were encountered: