Skip to content

Allow httpNodeCors to handle HTTP node preflights#5780

Open
puneetdixit200 wants to merge 1 commit into
node-red:mainfrom
puneetdixit200:fix-http-node-cors-preflight
Open

Allow httpNodeCors to handle HTTP node preflights#5780
puneetdixit200 wants to merge 1 commit into
node-red:mainfrom
puneetdixit200:fix-http-node-cors-preflight

Conversation

@puneetdixit200

Copy link
Copy Markdown
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

Fixes #5356

This changes the editor API CORS middleware so OPTIONS requests for paths under httpNodeRoot can continue through to the HTTP node app when httpNodeCors is configured.

That lets HTTP In preflights use the methods configured in httpNodeCors, including PATCH, instead of being answered first by the editor/admin CORS middleware. The same deferral is applied to both the default editor CORS middleware and a configured httpAdminCors middleware.

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run npm run test to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

Verification run:

  • npm install
  • ./node_modules/.bin/mocha test/unit/@node-red/editor-api/lib/index_spec.js --reporter spec
  • npm run build
  • ./node_modules/.bin/mocha "test/unit/@node-red/editor-api/lib/**/*_spec.js" --reporter dot
  • ./node_modules/.bin/jshint packages/node_modules/@node-red/editor-api/lib/index.js test/unit/@node-red/editor-api/lib/index_spec.js
  • git diff --check

@linux-foundation-easycla

Copy link
Copy Markdown

CLA Missing ID

  • ❌ The email address for the commit (300b8b4) is not linked to the GitHub account, preventing the EasyCLA check. Consult this Help Article and GitHub Help to resolve. (To view the commit's email address, add .patch at the end of this PR page's URL.) For further assistance with EasyCLA, please visit our EasyCLA portal and chat with our support bot.

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

Successfully merging this pull request may close these issues.

OPTIONS requests always return hardcoded CORS headers, breaking PATCH preflight

1 participant