pain with setting base url when needed access from outside by public ip and inside network by internal ip #9489

Closed
opened 2025-11-02 08:40:30 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @NikolayUvarov on GitHub (Aug 31, 2022).

Description

  1. when starting configuration server listens localhost and not 0.0.0.0 as stating in its log, so
    2022/08/31 10:29:54 cmd/web.go:217:listen() [I] [630f0df2] Listen: http://0.0.0.0:3000
    2022/08/31 10:29:54 cmd/web.go:221:listen() [I] [630f0df2] AppURL(ROOT_URL): http://localhost:3000/
    is just confusing. User cannot connect to server from outside to initial configuration

  2. when setting addres from local net as AppURL e.g. 192.168.2.12:3000 server actually does not listen to that address, but continues response on localhost:3000.

  3. user cannot connect to both external and internal addresses of a server

Gitea Version

1.17.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

initial run via command line, next was planned to run via systemd

Database

No response

Originally created by @NikolayUvarov on GitHub (Aug 31, 2022). ### Description 1) when starting configuration server listens localhost and not 0.0.0.0 as stating in its log, so 2022/08/31 10:29:54 cmd/web.go:217:listen() [I] [630f0df2] Listen: http://0.0.0.0:3000 2022/08/31 10:29:54 cmd/web.go:221:listen() [I] [630f0df2] AppURL(ROOT_URL): http://localhost:3000/ is just confusing. User cannot connect to server from outside to initial configuration 2) when setting addres from local net as AppURL e.g. 192.168.2.12:3000 server actually does not listen to that address, but continues response on localhost:3000. 3) user cannot connect to both external and internal addresses of a server ### Gitea Version 1.17.1 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? initial run via command line, next was planned to run via systemd ### Database _No response_
GiteaMirror added the issue/needs-feedback label 2025-11-02 08:40:30 -06:00
Author
Owner

@lunny commented on GitHub (Aug 31, 2022):

set ROOT_URL as your expected outside address

@lunny commented on GitHub (Aug 31, 2022): set `ROOT_URL` as your expected outside address
Author
Owner

@NikolayUvarov commented on GitHub (Aug 31, 2022):

then it does not work from inside. And I cannot set that url from outside via web console because I cannot access to console from remote. | can see that server works via wget localhost:3000 but not from 192.168.2.12:3000

@NikolayUvarov commented on GitHub (Aug 31, 2022): then it does not work from inside. And I cannot set that url from outside via web console because I cannot access to console from remote. | can see that server works via wget localhost:3000 but not from 192.168.2.12:3000
Author
Owner

@lunny commented on GitHub (Aug 31, 2022):

That's another issue which has been reported in #19345

@lunny commented on GitHub (Aug 31, 2022): That's another issue which has been reported in #19345
Author
Owner

@NikolayUvarov commented on GitHub (Aug 31, 2022):

please help: what should i do when internal access URL is http://192.168.2.12:3000/
and external is http://11.22.33.44:8000/ ?

@NikolayUvarov commented on GitHub (Aug 31, 2022): please help: what should i do when internal access URL is http://192.168.2.12:3000/ and external is http://11.22.33.44:8000/ ?
Author
Owner

@wxiaoguang commented on GitHub (Aug 31, 2022):

I will try to answer some questions, and at the same time, you could understand more about your system and environment.

1. when starting configuration server listens localhost and not 0.0.0.0 as stating in its log, so
   2022/08/31 10:29:54 cmd/web.go:217:listen() [I] [630f0df2] Listen: http://0.0.0.0:3000
   2022/08/31 10:29:54 cmd/web.go:221:listen() [I] [630f0df2] AppURL(ROOT_URL): http://localhost:3000/
   is just confusing. User cannot connect to server from outside to initial configuration

Since Gitea shows Listen: http://0.0.0.0:3000, then it's already listening on all IP addresses.

AppURL is just for UI display and URL construction, it does nothing to the Listen address.

If user can not access it, please check your firewall (nat, etc) or other rules.

2. when setting addres from local net as AppURL e.g. 192.168.2.12:3000 server actually does not listen to that address, but continues response on localhost:3000.

Which address?

3. user cannot connect to both external and internal addresses of a server

If Gitea is listening on "0.0.0.0:3000", it should work. Check your firewall and environment. Plenty of users use the same setting and do not have such problem, and there doesn't seem to be a problem indeed.

@wxiaoguang commented on GitHub (Aug 31, 2022): I will try to answer some questions, and at the same time, you could understand more about your system and environment. > 1. when starting configuration server listens localhost and not 0.0.0.0 as stating in its log, so > 2022/08/31 10:29:54 cmd/web.go:217:listen() [I] [630f0df2] Listen: http://0.0.0.0:3000 > 2022/08/31 10:29:54 cmd/web.go:221:listen() [I] [630f0df2] AppURL(ROOT_URL): http://localhost:3000/ > is just confusing. User cannot connect to server from outside to initial configuration Since Gitea shows `Listen: http://0.0.0.0:3000`, then it's already listening on all IP addresses. AppURL is just for UI display and URL construction, it does nothing to the Listen address. If user can not access it, please check your firewall (nat, etc) or other rules. > 2. when setting addres from local net as AppURL e.g. 192.168.2.12:3000 server actually does not listen to that address, but continues response on localhost:3000. Which address? > 3. user cannot connect to both external and internal addresses of a server If Gitea is listening on "0.0.0.0:3000", it should work. Check your firewall and environment. Plenty of users use the same setting and do not have such problem, and there doesn't seem to be a problem indeed.
Author
Owner

@NikolayUvarov commented on GitHub (Aug 31, 2022):

Yep, you was rigth about firewall, despite iptables-save was empty, some rules still persisted.
Thank you for clue.

@NikolayUvarov commented on GitHub (Aug 31, 2022): Yep, you was rigth about firewall, despite iptables-save was empty, some rules still persisted. Thank you for clue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9489