Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Simple functionality improvement for vhosts package

    Scheduled Pinned Locked Moved pfSense Packages
    1 Posts 1 Posters 1.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      lsoltero
      last edited by

      the vhost package should allow the entry of blank ("") hostnames. This would allow for the creation of default web servers that would respond to any requests on a given port.  As in …

      #the regex method isn't working
      #$HTTP["host"] =~ "(^|.)host01.com$" {
      #      server.document-root        = "/usr/local/vhosts/host01"
      #}

      $SERVER["socket"] == ":8080" {
                      server.document-root        = "/usr/local/vhosts/fusionpbx"
      }

      error-handler for status 404

      #server.error-handler-404  = "/error-handler.html"
      #server.error-handler-404  = "/error-handler.php"

      the current code creates the following which is in error
      $SERVER["socket"] == ":8080" {
          $HTTP["host" == "" {
                      server.document-root        = "/usr/local/vhosts/fusionpbx"
          }
      }

      here is a patch which addresses this issue and fixes it.

      –------
      --- vhosts.inc 2011-05-05 04:26:17.000000000 +0000
      +++ vhosts.inc.orig 2011-05-05 04:22:59.000000000 +0000
      @@ -325,9 +325,7 @@
      $tmp .= "$SERVER["socket"] == "".$ipaddress.":".$port."" {\n";
      }

      • if ( $host != "" ) {
      • $tmp .= " $HTTP["host"] == "".$host."" {\n";
      • }
      • $tmp .= " $HTTP["host"] == "".$host."" {\n";
        $tmp .= " server.document-root        = "/usr/local/vhosts/".$directory.""\n";

      //enable ssl if the cert and key were both provided
      @@ -340,7 +338,7 @@
      $tmp .= " ssl.engine = "enable"\n";
      unset($pem_file);
      }

      • if (count($vhostarray_http) > 0 && $host != "" ) {
      • if (count($vhostarray_http) > 0) {
        $tmp .= " }\n";
        }

      –------

      thanks,

      --luis

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.