question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CORS errror when uploading a file exceeding the limit

See original GitHub issue

Hello and thank you for your great work on this library.

I use it

  • with express-graphql on the server
  • with vuejs on the client (with graphql-upload-client).

Everything works fine except one thing:

  • if we try to upload a file exceeding the limit defined by maxFileSize the error message on localhost is correct: File truncated as it exceeds the 3000000 byte size limit.. But when I do the same on a remote VPS, the error is
POST https://api.my-app.tld/ 413
Access to XMLHttpRequest at 'https://api.my-app.tld/' from origin 'https://my-app.tld' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I tried to set the CORS Access-Control-Allow-Origin on the server to different values (including ‘*’), with no success.

Why is this error message different from localhost? How to control this error message?

Thank you


The repos are here:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

9reactions
francoisromaincommented, Nov 4, 2019

Ok. I finally found the source of the problem:

On the production server , we use this nginx proxy: https://github.com/jwilder/nginx-proxy, which has a 2Mb default upload limit. We changed by setting the client_max_body_size.

Thanks for your help

0reactions
mike-marcaccicommented, Nov 4, 2019

Aaah, that makes sense. Glad you figured it out!

Read more comments on GitHub >

github_iconTop Results From Across the Web

CORS error when uploading larger files - Stack Overflow
Make sure your Max allowed content Length in your web.config is set high enough otherwise you'll get an error. Check your IIS logs...
Read more >
CORS error only for uploading files bigger than around 2 MB
They often have limits set on the file size that can be uploaded - quick search shows Nginx defaults to 1 MB max,...
Read more >
Upload files in ASP.NET Core - Microsoft Learn
Set a maximum size limit to prevent large uploads. ... The following error indicates that the uploaded file exceeds the server's configured ......
Read more >
Cors error when uploading file - Laracasts
Hello, i'm facing again the cors error when i'm trying to upload file with axios my cors.php: [], 'allowed_methods' => ['*'], 'allowed_origins' ...
Read more >
Troubleshooting a failed canary - Amazon CloudWatch
Canary Failed. Error: No datapoint - Canary Shows timeout error Trying to access an internal endpointCross-origin request sharing (CORS) issue ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found