OpenWrt Forum Archive

Topic: Issue connecting to Web Server Over Internet

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

So I am having a strange issue, I am able to connect to my website internally but I am unable to connect to it from the external network (over the Internet).  My website runs just fine when I access it internally (192.168.1.1:81) or when I access it over my VPN (openVPN installed on router). When I use the same firewall configuration and change the destination port from 81 (my Webserver) to 82 (luci gui) I am able to access it luci externally (over the Internet)
Firewall configurations

config redirect
        option target 'DNAT'
        option src 'wan'
        option dest 'lan'
        option proto 'tcp'
        option src_dport '80'
        option dest_ip '192.168.1.1'
        option name 'Website'
        option dest_port '81'

config rule
        option target 'ACCEPT'
        option src 'wan'
        option proto 'tcp udp'
        option name 'Websites'
        option dest 'lan'
        option dest_ip '192.168.1.1'
        option src_port '80'
        option dest_port '81'

I am able to ping port 80 from outside my network

(Last edited by plivin89 on 18 Nov 2017, 00:41)

I am running wordpress on the router by the way and I am trying to access the wordpress site

plivin89 wrote:

I am running wordpress on the router by the way and I am trying to access the wordpress site

Since you can access it from within your network, I'm going out on a limb and assume you told WordPress its canonical address is "192.168.1.1", in which case it will always redirect to that address ... which is of course not reachable outside of your local private network.

(Last edited by metai on 18 Nov 2017, 11:10)

metai wrote:
plivin89 wrote:

I am running wordpress on the router by the way and I am trying to access the wordpress site

Since you can access it from within your network, I'm going out on a limb and assume you told WordPress its canonical address is "192.168.1.1", in which case it will always redirect to that address ... which is of course not reachable outside of your local private network.

I think you are on to something, lol how would I change that and what do I change it to ? I feel so stupid. Would if work if i configure dns or edit the routers host file to direct traffic going to 192.168.1.1 to website.com

(Last edited by plivin89 on 19 Nov 2017, 03:16)

Actually exactly the other way around.

Firstly, If you already installed WordPress, it configured itself to the address it has been installed on and will always want to redirect to that address. If that was http://192.168.1.1/ it is now configured to that. You can edit the values in the wp_options database table or edit wp-config.php and set WP_SITEURL and WP_HOME to reflect your new URL.

... which should be an URL that is reachable from the internet pointing to your router, i.e. www.example.com or some ddns service. You can then edit your router's DNS to translate www.example.com to 192.168.1.1 so internal requests will not try to go outside of your network. (WordPress does not care about the HTTP host it was accessed with, not what IP that HTTP host translates to.)

(Last edited by metai on 19 Nov 2017, 09:50)

Thank you for your response, I solved the issue by replacing 192.168.1.1 with my public ip address That seem to have solved the issue

The discussion might have continued from here.