Skip to content

Add support for multiple static paths with optional static root #3542

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

Merged
merged 2 commits into from
Apr 25, 2022

Conversation

Steve-Mcl
Copy link
Contributor

closes #3510

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

Permits single or multiple static source paths and allows each of those to be served from a different root

By adding the httpStaticRoot we can avoid the need for changing httpAdminRoot when httpStatic is enabled.

Examples...

==========

Single path, default root

Settings File
    httpStatic: 'c:\\temp',
    //httpStaticRoot: '/',
Log Output
22 Apr 17:05:34 - [info] HTTP Static    : c:\temp > /

Multiple paths, alternative base root

Settings File
    httpStatic: [{path:'c:\\temp'}, {path:'c:\\tmp'}],
    httpStaticRoot: '/static_stuff/',
Log Output
22 Apr 17:05:34 - [info] HTTP Static    : c:\temp > /static_stuff/
22 Apr 17:05:34 - [info] HTTP Static    : c:\tmp > /static_stuff/

Multiple paths with default root and individual root

Settings File
    httpStatic: [{path:'c:\\temp', root: "/stuff/"}, {path:'c:\\tmp', root: "/other/"}],
    //httpStaticRoot: '/',
Log Output
22 Apr 17:05:34 - [info] HTTP Static    : c:\temp > /stuff/
22 Apr 17:05:34 - [info] HTTP Static    : c:\tmp > /other/

Multiple paths with base root and individual root

Settings File
    httpStatic: [{path:'c:\\temp', root: "/stuff/"}, {path:'c:\\tmp', root: "/other/"}],
    httpStaticRoot: '/static/',
Log Output
22 Apr 17:05:34 - [info] HTTP Static    : c:\temp > /static/stuff/
22 Apr 17:05:34 - [info] HTTP Static    : c:\tmp > /static/other/

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run grunt to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

@coveralls
Copy link

coveralls commented Apr 22, 2022

Coverage Status

Coverage decreased (-0.1%) to 68.655% when pulling 4715704 on Steve-Mcl:httpstatic-improvements into d802ce1 on node-red:dev.

@knolleary knolleary merged commit 57ac90f into node-red:dev Apr 25, 2022
@Steve-Mcl Steve-Mcl deleted the httpstatic-improvements branch April 25, 2022 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Documenting
Development

Successfully merging this pull request may close these issues.

3 participants