LogoLogo
Greenstand Microservices
Greenstand Microservices
  • Microservices Directory
  • Service Review
  • Team Projects
  • Helpful Topics
    • CORS
  • Domain Migration
    • Treetracker Domain Migration Sequencing
    • Domain Migration M2
    • Domain modeling notes
    • Treetracker Schema Attributes
    • Implementation Pathway
  • Capture Verification
  • Bulk Pack
  • Development Paths
  • Messaging System Rollout Decisions
  • Testing Methodology
  • Software Layers
  • Grower Unique Identifier Notes
  • Contract Service
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
Export as PDF
  1. Helpful Topics

CORS

PreviousTeam ProjectsNextTreetracker Domain Migration Sequencing

Last updated 3 years ago

Was this helpful?

Disable CORS for working on a microservice API with localhost

  • Disable CORS for development by importing "cors" and then use it to disable cors for 'development' in each microservice

    if (process.env.NODE_ENV === 'development') { log.info('disable cors'); app.use(cors()); }

    EXAMPLE w/ cors:

    EXAMPLE w/ header options:

  • Chrome extension that will let you disable CORS when you want without having to shutdown

    • Simple option: or - You can click the red button to make it active when you want to disable CORS.

    • Lots of settings, but you have to create an account:

  • Try different browsers or the proxy setting for CRA.

  • Create your own proxy server:

Helpful reading!

Debugging: Explain settings: CORS module settings:

https://github.com/Greenstand/treetracker-stakeholder-api/blob/main/server/app.js
https://github.com/Greenstand/treetracker-web-map-api/blob/master/src/app.js
Cross Domain CORS
Moesif CORS
Requestly
https://medium.com/swlh/avoiding-cors-errors-on-localhost-in-2020-5a656ed8cefa
https://medium.com/nodejsmadeeasy/a-simple-cors-proxy-for-javascript-applications-9b36a8d39c51
https://httptoolkit.tech/blog/how-to-debug-cors-errors/
https://web.dev/cross-origin-resource-sharing/
https://expressjs.com/en/resources/middleware/cors.html