iisnode не хранит повар ie в Chrome - PullRequest
0 голосов
/ 02 апреля 2020

У меня есть nodejs / expressjs Настройка проекта Web API, которая прекрасно работает при локальном тестировании. Но когда я тестирую, отправляя запрос к API, размещенному в IIS, Google Chrome не спасает повара ie. В противном случае с Firefox, где я делаю запрос на вход в систему, но это не сохраняет повар ie, однако я могу запросить ресурсы, защищенные аутентификацией. С почтальоном у меня нет проблем.

   <system.webServer>
   <handlers>  
      <add name="iisnode" path="app.js" verb="*" modules="iisnode" />  
    </handlers>  
     <rewrite>
       <rules>
         <rule name="api">
           <match url="api/*" />
           <action type="Rewrite" url="app.js" />
         </rule>
       </rules>
     </rewrite>
     <iisnode 
       enableXFF="true"
       nodeProcessCommandLine="&quot;%programfiles%\nodejs\node.exe&quot;"  
       interceptor="&quot;%programfiles%\iisnode\interceptor.js&quot;" />
    <httpErrors existingResponse="PassThrough" />
   </system.webServer>
</configuration>

Это приложение. js

app.set('trust proxy', 1)
app.use(
    cors({
        credentials: true,
        origin: true
    })
);
app.use(morgan('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
mongoose.connect(keys.mongodb.dbURI, { useNewUrlParser: true });

app.use(session({
    proxy: true,
    secret: keys.session.cookieKey,
    resave: false,
    saveUninitialized: false,
    cookie: { maxAge: 1 * 60000, httpOnly: false },
    store: new MongoStore({
        mongooseConnection: mongoose.connection
    })
}));

Это часть кода, отправляющая запрос к iisnode

      axios.defaults.withCredentials = true;
      axios
        .post("http://xxx.xxx.xxx.xxx//api/login", {
          email: this.email,
          password: this.password,
          withCredentials: true
      })
   .then(response => {
...