[GH-ISSUE #228] Force SSL missing when using Custom locations #200

Closed
opened 2026-02-26 06:31:25 +03:00 by kerem · 7 comments
Owner

Originally created by @crawc on GitHub (Nov 4, 2019).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/228

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    YES, pulled today.

  • Are you sure you're not using someone else's docker image?
    Yes, jc21/nginx-proxy-manager:latest

  • If having problems with Lets Encrypt, have you made absolutely sure your site is accessible from outside of your network? Not useing Lets Encrypt, but using custom SSL certs.

Describe the bug

  • A clear and concise description of what the bug is.
    After adding a Proxy host using a custom SSL cert (I don't think this matters, but might) with the Force SSL option enabled the site redirects a expected, but when I add a Custom location, with Force SSL still enabled the redirection for HTTP to HTTPS no longer works or these lines are removed.

# Force SSL
include conf.d/include/force-ssl.conf;

These line can be be added back using the Advanced tab as a workaround. It seems the Force SSL is skipped when a Custom location is being used.

  • What version of Nginx Proxy Manager is reported on the login page?
    v2.0.14

To Reproduce
Steps to reproduce the behavior:

  1. Add a new Proxy host with Force SSL enabled.
  2. Check the generated config file to confirm it has the force SSL lines. data/nginx/proxy_host/1.conf
  3. Add a Custom location.
  4. Check the generated config file to confirm it has the force SSL lines are now missing.

Expected behavior
To continue to include the force-ssl.conf file when a custom location is added.

Originally created by @crawc on GitHub (Nov 4, 2019). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/228 **Checklist** - Have you pulled and found the error with `jc21/nginx-proxy-manager:latest` docker image? YES, pulled today. - Are you sure you're not using someone else's docker image? Yes, `jc21/nginx-proxy-manager:latest` - If having problems with Lets Encrypt, have you made absolutely sure your site is accessible from outside of your network? Not useing Lets Encrypt, but using custom SSL certs. **Describe the bug** - A clear and concise description of what the bug is. After adding a Proxy host using a custom SSL cert (I don't think this matters, but might) with the Force SSL option enabled the site redirects a expected, but when I add a Custom location, with Force SSL still enabled the redirection for HTTP to HTTPS no longer works or these lines are removed. ` # Force SSL` ` include conf.d/include/force-ssl.conf;` These line can be be added back using the Advanced tab as a workaround. It seems the Force SSL is skipped when a Custom location is being used. - What version of Nginx Proxy Manager is reported on the login page? `v2.0.14` **To Reproduce** Steps to reproduce the behavior: 1. Add a new Proxy host with Force SSL enabled. 2. Check the generated config file to confirm it has the force SSL lines. `data/nginx/proxy_host/1.conf` 3. Add a Custom location. 4. Check the generated config file to confirm it has the force SSL lines are now missing. **Expected behavior** To continue to include the `force-ssl.conf` file when a custom location is added.
kerem 2026-02-26 06:31:25 +03:00
  • closed this issue
  • added the
    stale
    bug
    labels
Author
Owner

@Kenchava commented on GitHub (Jul 26, 2020):

i just encountered this issue on v2.3.1, I bypassed it by adding the include conf.d/include/force-ssl.conf; line to the custom configuration of each location, but still kind of annoying...

<!-- gh-comment-id:663927790 --> @Kenchava commented on GitHub (Jul 26, 2020): i just encountered this issue on v2.3.1, I bypassed it by adding the `include conf.d/include/force-ssl.conf;` line to the custom configuration of each location, but still kind of annoying...
Author
Owner

@Anunayj commented on GitHub (Feb 16, 2021):

Is there any reason as to why http-> https rewrite for forced SSL should be in the location / block and not part of the global server block? (same for HSTS)
github.com/jc21/nginx-proxy-manager@301499dc52/backend/templates/proxy_host.conf (L46)
Right now it does not work with custom locations because using another location / block would prioritize it over the first one.

<!-- gh-comment-id:779888490 --> @Anunayj commented on GitHub (Feb 16, 2021): Is there any reason as to why http-> https rewrite for forced SSL should be in the `location /` block and not part of the global server block? (same for HSTS) https://github.com/jc21/nginx-proxy-manager/blob/301499dc525d39f226b391fb88f28385ce0cb008/backend/templates/proxy_host.conf#L46 Right now it does not work with custom locations because using another `location /` block would prioritize it over the first one.
Author
Owner
<!-- gh-comment-id:779894067 --> @Anunayj commented on GitHub (Feb 16, 2021): To add to that, there seem to be redundant HSTS entries https://github.com/jc21/nginx-proxy-manager/blob/301499dc525d39f226b391fb88f28385ce0cb008/backend/templates/proxy_host.conf#L47 https://github.com/jc21/nginx-proxy-manager/blob/301499dc525d39f226b391fb88f28385ce0cb008/backend/templates/proxy_host.conf#L13
Author
Owner

@chaptergy commented on GitHub (May 11, 2021):

@Anunayj see https://github.com/jc21/nginx-proxy-manager/issues/68#issuecomment-465820723 for his explanation

<!-- gh-comment-id:838947247 --> @chaptergy commented on GitHub (May 11, 2021): @Anunayj see https://github.com/jc21/nginx-proxy-manager/issues/68#issuecomment-465820723 for his explanation
Author
Owner

@henkisdabro commented on GitHub (Jun 9, 2021):

I'm still having troubles with this. Statically hosted files served via NPM render continous 301 redirects unless I disable the checkbox for Force SSL. Even adding in the include line and manually adding the if statement into the custom box, I can't get this to work.

<!-- gh-comment-id:857380181 --> @henkisdabro commented on GitHub (Jun 9, 2021): I'm still having troubles with this. Statically hosted files served via NPM render continous 301 redirects unless I disable the checkbox for Force SSL. Even adding in the include line and manually adding the if statement into the custom box, I can't get this to work.
Author
Owner

@github-actions[bot] commented on GitHub (Apr 1, 2024):

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

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

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

Issue was closed due to inactivity.

<!-- gh-comment-id:2869348981 --> @github-actions[bot] commented on GitHub (May 11, 2025): Issue was closed due to inactivity.
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#200
No description provided.