[GH-ISSUE #783] Trim Whitespace #661

Open
opened 2026-02-26 06:33:53 +03:00 by kerem · 8 comments
Owner

Originally created by @jjtroberts on GitHub (Dec 18, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/783

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
image

Originally created by @jjtroberts on GitHub (Dec 18, 2020). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/783 **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](https://github.com/thedersen/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** ![image](https://user-images.githubusercontent.com/18486187/102635637-3b4fb780-4119-11eb-9523-9b72da0eab7a.png)
Author
Owner

@github-actions[bot] commented on GitHub (Mar 22, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2014167358 --> @github-actions[bot] commented on GitHub (Mar 22, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@fgiering commented on GitHub (Jun 3, 2024):

keep it open

<!-- gh-comment-id:2145199901 --> @fgiering commented on GitHub (Jun 3, 2024): keep it open
Author
Owner

@github-actions[bot] commented on GitHub (May 2, 2025):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2846146443 --> @github-actions[bot] commented on GitHub (May 2, 2025): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@fgiering commented on GitHub (May 2, 2025):

👍🏼

<!-- gh-comment-id:2846454360 --> @fgiering commented on GitHub (May 2, 2025): 👍🏼
Author
Owner

@github-actions[bot] commented on GitHub (Jan 2, 2026):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:3704340082 --> @github-actions[bot] commented on GitHub (Jan 2, 2026): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@jjtroberts commented on GitHub (Jan 2, 2026):

👍

<!-- gh-comment-id:3704373457 --> @jjtroberts commented on GitHub (Jan 2, 2026): 👍
Author
Owner

@jjtroberts commented on GitHub (Jan 2, 2026):

👍

<!-- gh-comment-id:3704373482 --> @jjtroberts commented on GitHub (Jan 2, 2026): 👍
Author
Owner

@fgiering commented on GitHub (Jan 2, 2026):

👍

<!-- gh-comment-id:3705334945 --> @fgiering commented on GitHub (Jan 2, 2026): 👍
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#661
No description provided.