question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[V5] Verdaccio is not working behind http2 proxy

See original GitHub issue

Describe the bug

Verdaccio v5 is not detecting headers passed from reverse proxy, I think it’s because of http2 is lowercasing all headers

log

{
  "level": 25,
  "time": 1619156769309,
  "pid": 7,
  "hostname": "verdaccio-5bdb8cd95f-6d78j",
  "req":
  {
    "method": "GET",
    "url": "/",
    "query": {},
    "params": {},
    "headers":
    {
      "host": "npm.domain.com",
      "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36",
      "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
      "accept-encoding": "gzip, deflate, br",
      "accept-language": "en-US,en;q=0.9,de;q=0.8",
      "cache-control": "no-cache",
      "pragma": "no-cache",
      "sec-ch-ua": "\"Google Chrome\";v=\"89\", \"Chromium\";v=\"89\", \";Not A Brand\";v=\"99\"",
      "sec-ch-ua-mobile": "?0",
      "sec-fetch-dest": "document",
      "sec-fetch-mode": "navigate",
      "sec-fetch-site": "none",
      "sec-fetch-user": "?1",
      "upgrade-insecure-requests": "1",
      "x-forwarded-for": "172.30.2.20",
      "x-forwarded-host": "npm.domain.com",
      "x-forwarded-port": "443",
      "x-forwarded-proto": "https",
      "x-forwarded-server": "internal-traefik-6d4789455-hnklc",
      "x-real-ip": "172.30.2.20"
    },
    "remoteAddress": "10.42.235.33",
    "remotePort": 38724
  },
  "ip": "10.42.235.33",
  "msg": "@{ip} requested '@{req.method} @{req.url}'"
}

Woraround: override VERDACCIO_PUBLIC_URL

To Reproduce

running verdaccio behind traefik reverse proxy, which is terminating https (http2) connection.

Expected behavior

Verdaccio should detect lowercase reverse proxy headers.

Screenshots

Configuration File (cat ~/.config/verdaccio/config.yaml)

Environment information

Debugging output

  • $ NODE_DEBUG=request verdaccio display request calls (verdaccio <–> uplinks)
  • $ DEBUG=express:* verdaccio enable extreme verdaccio debug mode (verdaccio api)
  • $ npm -ddd prints:
  • $ npm config get registry prints:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:24 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
viceicecommented, May 6, 2021

@FStefanni better to provide a simple docker-compose.yml with minimal config. For testing the default traefik generated cert would be enough. Traefik dashboard is not needed for testing, but a local host alias for a custom domain will help

1reaction
FStefannicommented, Jun 7, 2021

Hi,

just to confirm that verdaccio:5.1.0 works fine behind Traefik. Thank you for the effort.

Regards.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reverse Proxy Setup - Verdaccio
Using a reverse proxy is a common practice. ... Apache and mod_proxy should not decode/encode slashes and leave them as they are:.
Read more >
Configuration File - Verdaccio
WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301.
Read more >
Installation - Verdaccio
Verdaccio is a Node.js private and proxy registry. To install it, you need a few basic prerequisites.
Read more >
Server Configuration - Verdaccio
Running as a separate user​. First create a Verdaccio user: $ sudo adduser --system --gecos 'Verdaccio NPM ...
Read more >
Verdaccio 5 migration guidelines
One tecnical reasons is that pino.final does not work with prettier option. ... to be used behind proxies, this variable will be used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found