Giter Site home page Giter Site logo

Comments (3)

jonchurch avatar jonchurch commented on April 27, 2024 1

the package's responsibility ends after its middleware finishes running. what happens between then and logging the headers in the browser can be influenced by an excitingly large number of things. if you create a minimal repro that points to cors as a likely culprit, we can dig in further

start here though to save yourself some sanity if this is still an active issue for you

const express = require('express');
const cors = require('cors');
const app = express();

app.use(cors({
  exposedHeaders: ['Patient-Sequence-Number', 'Professional-Sequence-Number']
}));
// put this middleware immediately after registering the cors middleware
app.use((req, res, next) => {
  console.log('Headers after CORS middleware:', res.getHeaders());
  next();
});

// Wrapping res.send to log before sending the response
const originalSend = res.send;
res.send = function(...args) {
  console.log('Headers before sending response:', this.getHeaders());
  originalSend.apply(this, args);
};

app.get('/api-health-check', function (req, res) {
  try {
    res.sendStatus(200);
  } catch (e) {
    return res.status(503).send('API health check error ' + e);
  }
});

app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

from cors.

gdbjohnson avatar gdbjohnson commented on April 27, 2024

I've found that when I have an array for the origin, the Access-Control-Allow-Origin header is missing. when it is a single valued string, it is there

from cors.

jonchurch avatar jonchurch commented on April 27, 2024

Can reopen if we get more info that points to an issue

from cors.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.