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

Closed
opened 2025-11-02 03:33:50 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @MCF on GitHub (May 13, 2017).

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

Originally created by @MCF on GitHub (May 13, 2017). 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: ```golang [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
GiteaMirror added the type/feature label 2025-11-02 03:33:50 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#710