NginxProxyManager / NginxProxyManager/nginx-proxy-manager
Trim Whitespace
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 34.2k
- Forks
- 3.9k
- Avg merge
- 21h 12m
- Merged PRs (30d)
- 20
Description
Is your feature request related to a problem? Please describe.
I errantly copied and pasted a trailing whitespace into a redirection host destination field which resulted in an invalid nginx config because the whitespace broke the expected syntax of the nginx redirect directive:
# this
return 301 $scheme://example.com/example/?_vsrefdom=web_default $request_uri;
# instead of this
return 301 $scheme://example.com/example/?_vsrefdom=web_default$request_uri;
[12/18/2020] [3:49:09 PM] [Express ] › ⚠ warning Command failed: /usr/sbin/nginx -t -g "error_log off;"
nginx: [emerg] invalid number of arguments in "return" directive in /data/nginx/redirection_host/1.conf:33
nginx: configuration file /etc/nginx/nginx.conf test failed
I am also able to paste a full URL with the scheme and it is accepted even though it would result in an invalid redirect.
return 301 $scheme://https://example.com/example/?_vsrefdom=web_default $request_uri;
Describe the solution you'd like
I am attempting to provide a self-service redirection portal to less-technical users and adding blocking input validation checks prior to submission will likely alleviate future pain. A regex input validation step would be tremendously helpful in filtering out some of the inappropriate input that less-technical users will likely copy and paste into that field.
I'm not a JS developer, but perhaps something like Backbone.Validation would help.
Describe alternatives you've considered
npm is a blessing and thank you for providing it. I understand you are not compensated for your efforts. We could probably get by with training our staff to look for whitespace and scheme prior to submitting a redirect. However it would help me sleep better at night knowing they can't easily break the nginx config and require an engineer to log in and repair it.
Additional context

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the redirection host destination field and the submission path that generates the nginx redirect directive. Check how pasted whitespace and full URLs are handled, then verify that invalid values are rejected before submission and that accepted input produces a valid nginx configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nginx, typescript
- Domain
- backend, frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100