Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: url_prefix behaviour #2122

Merged
merged 17 commits into from
Mar 29, 2021
Merged

fix: url_prefix behaviour #2122

merged 17 commits into from
Mar 29, 2021

Conversation

juanpicado
Copy link
Member

@juanpicado juanpicado commented Mar 11, 2021

This fix is based on #2070 for the next major, but I plan to move some fix to the v4 so we can solve this situation with no breaking changes.

Scheduled release: next minor

url_prefix

The new internal logic builds correctly the public url, validates the host header and and bad shaped url_prefix.

eg: url_prefix: /verdaccio, url_prefix: verdaccio/, url_prefix: verdaccio would be /verdaccio/

Public URL

The new VERDACCIO_PUBLIC_URL is intended to be used behind proxies, this variable will be used for:

  • Used as base path to serve UI resources as (js, favicon, etc)
  • Used on return metadata dist base path
  • Ignores host and X-Forwarded-Proto headers
  • If url_prefix is defined would be appened to the env variable.
VERDACCIO_PUBLIC_URL='https://somedomain.org';
url_prefix: '/my_prefix'

// url -> https://somedomain.org/my_prefix/

VERDACCIO_PUBLIC_URL='https://somedomain.org';
url_prefix: '/'

// url -> https://somedomain.org/

VERDACCIO_PUBLIC_URL='https://somedomain.org/first_prefix';
url_prefix: '/second_prefix'

// url -> https://somedomain.org/second_prefix/'

Screenshot from 2021-03-24 20-20-11

Custom favicon

The favicon can be replaced in 2 ways:

Local absolute path

web:
  title: Verdaccio
  logo: /home/user/favicon.ico

By URL

web:
  title: Verdaccio
  logo: https://somedomain.org/favicon.ico

If the logo is not defined, will fetch (and bundled in) the custom verdaccio favicon

UI

  • Does not contain any CSS, SVG or Fonts anymore
  • Only JS
  • Ability add your own CSS, JS at the HTML

Web new properties for dynamic template

The new set of properties are made in order allow inject html and JavaScript scripts within the template. This
might be useful for scenarios like Google Analytics scripts or custom html in any part of the body.

  • metaScripts: html injected before close the head element.
  • scriptsBodyAfter: html injected before close the body element.
  • bodyAfter: html injected after verdaccio JS scripts.
web:
  scriptsBodyAfter:
    - '<script type="text/javascript" src="https://my.company.com/customJS.min.js"></script>'
  metaScripts:
    - '<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>'
    - '<script type="text/javascript" src="https://browser.sentry-cdn.com/5.15.5/bundle.min.js"></script>'
    - '<meta name="robots" content="noindex" />'
  scriptsbodyBefore:
    - '<div id="myId">html before webpack scripts</div>'

@juanpicado juanpicado linked an issue Mar 11, 2021 that may be closed by this pull request
@juanpicado juanpicado added this to the 4.x.x milestone Mar 11, 2021
@juanpicado juanpicado self-assigned this Mar 11, 2021
@juanpicado juanpicado linked an issue Mar 11, 2021 that may be closed by this pull request
@juanpicado juanpicado modified the milestones: 4.x.x, 5.x Mar 28, 2021
@juanpicado juanpicado marked this pull request as ready for review March 29, 2021 10:18
verdacciobot
verdacciobot previously approved these changes Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

url_prefix changed behaviour with 4.2.2 Routing not using proxy path [windows/iis]
2 participants