Skip to content

Setting scheme: auto via API or UI results in invalid redirect behavior #4692

@sandeepgs24x7

Description

@sandeepgs24x7

Checklist

  • Have you pulled and found the error with jc21/nginx-proxy-manager:latest docker image?
    • Yes
  • Are you sure you're not using someone else's docker image?
    • Yes
  • Have you searched for similar issues (both open and closed)?

Describe the bug
When creating a redirect host using the API endpoint api/nginx/redirection-hosts with "forward_scheme": "auto", the redirect results in a broken URL like auto://google.com. This is not a valid scheme and causes the redirect to fail.

Additionally, when attempting to set "auto" as the scheme in the web UI, the following validation error is shown: data/forward_scheme must be equal to one of the allowed values

This reveals inconsistent behavior:

  • The API accepts "auto" but results in a broken redirect.
  • The UI correctly rejects "auto" as invalid although it is an option in the form.

Nginx Proxy Manager Version
v2.12.6

To Reproduce
- Using the REST API:

  1. Send a POST request to /api/nginx/redirection-hosts with the following JSON payload:
   {
     "domain_names": ["mydomain.com"],
     "forward_scheme": "auto",
     "forward_domain_name": "google.com",
     "forward_http_code": 300,
     "preserve_path": true
   } 
  1. Access http://mydomain.com in a browser.
  2. Observe that the redirect attempts to go to auto://google.com.

- Using the UI:

  1. Open the Nginx Proxy Manager web UI.
  2. Go to the "Redirect Hosts" section and click "Add Redirection Host".
  3. Fill in domain and forward details.
  4. Set Scheme = auto.
  5. Try to save.
  6. See the following error: data/forward_scheme must be equal to one of the allowed values

Expected behavior

  1. If "auto" is intended to be a supported scheme, the redirect should dynamically use the original request's scheme (http or https).
  2. If "auto" is not a supported value, it should be rejected consistently across both the API and UI with a validation error.

Additional context
A related issue (#4080) covers the UI validation problem, but this report also includes the API behavior and resulting redirect failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions