How to avoid “refused to connect” for public host names from inside a VPN?

Discussion in 'Nginx' started by J. Parker, Mar 5, 2020.

  1. #1
    I'm using a Windows server, that is behind a Nginx proxy within a VPN, as a development workstation. I am trying to connect to a Moodle server in the same subnet using either a public or private host name. I can ping the public host name, e.g. moodle.mydomain.com, but a browser fails to connect to that same public site name.

    If I use a private host name, i.e. moodle.vpn3.mydomain.com, or a local IP Address, 192.168.1.175, a browser connects initially, but subsequent pages revert to using the public host name, which then fails to connect. This is because of the settings, $CFG->wwwroot = 'http:/public-hostname'; and $CFG->reverseproxy = true;, in Moodle’s config.php, which only allows a single hostname for the website. (Note if I set $CFG->reverseproxy = false; then from outside, the browser returns "too many redirects".

    How can I utilize both a public and private site name to access my Moodle server from inside or outside my VPN, respectively? Alternatively, how can I configure my Nginx proxy and/or my DNS to allow HTTP connections to a public host name from inside my VPN?
     
    J. Parker, Mar 5, 2020 IP
  2. SolaDrive

    SolaDrive Well-Known Member

    Messages:
    135
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    153
    #2
    Your nginx proxy sounds like it is not setup right with the proper bindings to public/private ports and IP's, or in this case your network interfaces. Are you hosting this locally on your own system or a remotely hosted windows system?
     
    SolaDrive, Mar 18, 2020 IP