Skip to content

Configuration 'logLevel' flags being overwritten by LATEST configuration. #351

Closed
@JamesHearts

Description

@JamesHearts

Is this a bug report?

Yes

Steps to reproduce

  1. Create multiple proxy configurations. For example:
const restProxy = proxy({
    target: host.address,
    pathRewrite: {
        '^/rest-service/*' : '/'
    },
    logLevel: 'debug'
});

const reportProxy = proxy({
    target: host.protocol  + '://' + host.ip,
    pathRewrite: {
        '^/report-service/*' : '/'
    },
    logLevel: 'silent'
});
  1. Trigger the proxy middleware and notice that the logLevel: 'debug' flag on your first configuration get ignored. Found that it was getting ignored by debugging Logger class, specifically _showLevel function.

Expected behavior

Should be able to set 'logLevel' per configuration. Noticed this happening on Angular-CLI/Webpack proxy as well. (not sure if related). I may be wrong in this assumption. In that case works correctly.

Actual behavior

Latest configuration loaded gets to decide 'logLevel'.

Setup

  • "http-proxy-middleware": "^0.19.0"
  • "express": "^4.16.2"
  • node v8.12.0
  • "@angular/cli": "^6.2.9"

client info

Windows 10 Enterprise Version 1809

target server info

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions