NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
21.94k stars 2.53k forks source link

Trim Whitespace #783

Open jjtroberts opened 3 years ago

jjtroberts commented 3 years ago

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

github-actions[bot] commented 5 months ago

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

fgiering commented 3 months ago

keep it open