Skip to content

How to redirect a URL:PORT to URL #4362

@IoSonoPiero

Description

@IoSonoPiero

Hello people,
I posted this request on Reddit before bothering here because sometimes I think people make things more complex.
Said that I could pay for support if needed.

I'm using Nginx Proxy Manager (NPM) in Docker to manage my domains and reverse proxy configurations.

I have an application that generates URLs with, for example, :8080 at the end, and unfortunately, I cannot modify this behaviour within the application itself.
For example:

  • The application generates: https://example.fake-domain.com:8080
  • I want it to redirect automatically to: https://example.fake-domain.com (without the port in the URL).

The current setup on Nginx Proxy Manager is as follows:

  1. Proxy Host Configuration:
    • Domain Name: example.fake-domain.com
    • Scheme: HTTP
    • Forward Hostname/IP: my-app-container
    • Forward Port: 8080
    • Websockets Support: Enabled
    • Block Common Exploits: Enabled
  2. SSL Settings:
    • Certificate is valid for example.fake-domain.com.
    • SSL options like "Force SSL" and "HTTP/2 Support" are currently disabled.

I tried to add in

  • Advanced Settings:
    • port_in_redirect off;, in my mind, is to prevent Nginx from appending the port in redirects.
      And in this case, when I try to access:s https://example.fake-domain.com:8080, I encounter the following error:

Secure Connection Failed
SSL_ERROR_RX_RECORD_TOO_LONG

So, I'm looking for a way to:

  1. Automatically redirect requests from https://example.fake-domain.com:8080 to https://example.fake-domain.com.
  2. Avoid at all that specific port in a more complex URL like: https://example.fake-domain.com:8080/something.html to https://example.fake-domain.com/something.html

Any help would be greatly appreciated!

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