Skip to content

Feature suggestion - Option to redirect http to https when protocol = https #1720

@MCF

Description

@MCF

I'd like to redirect users who arrive on port 80 to port 443. I am running a small gitea instance using https without an additional webserver component (e.g. nginx), and it seems it is not possible to do this with gitea alone. I like the small lightweight gitea server approach and do not want to drop in another web server. Would it be possible to add an option to have the gitea web server do the redirection?

Perhaps the option would be something like:

[server]
PROTOCOL = https
REDIRECT_HTTP_TO_HTTPS = true

And the new option is only used if PROTOCOL = https.

I'd be happy to prepare a pull request for the feature if the core devs think it would be useful. I would probably adapt this example for the actual redirection:

https://gist.github.com/d-schmidt/587ceec34ce1334a5e60

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/featureCompletely new functionality. Can only be merged if feature freeze is not active.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions