Skip to content
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

Receiving CORS error when request URL becomes too long #1928

Closed
JPStrydom opened this issue Apr 24, 2020 · 4 comments
Closed

Receiving CORS error when request URL becomes too long #1928

JPStrydom opened this issue Apr 24, 2020 · 4 comments

Comments

@JPStrydom
Copy link

Steps to reproduce

I have a feathers API with a MongoDB behind it and an Angular website, all running in a Docker container. All functioned normally until I recently started receiving CORS errors on some of my requests. I realised that the only difference between failing requests and successful ones is their length. The base request works and certain queries work separately, but as soon as I have all the queries in one request I receive a CORS error. A request of character length 485 works fine, but one of length 625 gives a CORS error. So at some length in between those it must be failing

Expected behavior

My request should return the data I'm querying.

Actual behavior

I receive the following error:

Access to XMLHttpRequest at 'REQUEST' from origin 'FRONT-END' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

System configuration

Module versions (especially the part that's not working): My package.json contains the following relevant feathers packages:

...
"dependencies": {
    "@feathersjs/authentication": "^2.1.7",
    "@feathersjs/authentication-jwt": "^2.0.1",
    "@feathersjs/configuration": "^1.0.2",
    "@feathersjs/errors": "^3.3.0",
    "@feathersjs/express": "^1.2.3",
    "@feathersjs/feathers": "^3.1.7",
    "@feathersjs/socketio": "^3.2.2",
    "feathers-hooks-common": "^4.15.0",
    "feathers-logger": "^0.2.3",
    "feathers-memory": "^2.1.3",
    "feathers-mongodb": "^2.9.1",
    "feathers-mongodb-fuzzy-search": "^1.1.1",
    "feathers-mongoose": "^5.1.2",
    "feathers-populate-hook": "^0.2.3",
    "feathers-swagger": "^1.1.0",
    ...
  },
  ...

NodeJS version: 10.15.3

Operating System: Windows 10 Pro (10.0.18363 (64-bit))

Browser Version: Tested on latest Chrome (Version 81.0.4044.113 (64-bit)) and Opera (Version:65.0.3467.78 (64-bit)) browser

@daffl
Copy link
Member

daffl commented Apr 30, 2020

This might be a restriction in Express or the cors module. Another possible issue could be the query string array limit.

@JPStrydom
Copy link
Author

This might be a restriction in Express or the cors module. Another possible issue could be the query string array limit.

I'll give this a shot, thanks!

@ScooterDelta
Copy link

Thanks for the help @daffl. We found the issue afterall, it wasn't to do with Feathers.js directly, but was rather due to the Node HTTP_MAX_HEADER_SIZE:

@daffl
Copy link
Member

daffl commented May 18, 2020

This is good to know, thanks for sharing!

@daffl daffl closed this as completed May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants