Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow docroot with mod_vhost_alias virtual_docroot #2195

Merged
merged 4 commits into from
Sep 27, 2021

Conversation

yakatz
Copy link
Contributor

@yakatz yakatz commented Sep 20, 2021

DocumentRoot is used for other directives when a Virtual Document Root is not found.
For backwards compatibility, docroot is still ignored unless you set the virtual_use_default_docroot to true.

For example, to show a custom 404 message, you might use mod_rewrite, but that needs a DocumentRoot to be set:

# ************************************
# Vhost template in module puppetlabs-apache
# Managed by Puppet
# ************************************
#
<VirtualHost *:80>
  ServerName projects.example.com

  ## Vhost docroot
  VirtualDocumentRoot "/var/www/projects/_webroots/%0"
  DocumentRoot "/var/www/projects/_webroots"

  ## Directories, there should at least be a declaration for /fs/www/projects/_webroots

  <Directory "/fs/www/projects">
    Options FollowSymLinks MultiViews Indexes
    AllowOverride None
    Require all granted
  </Directory>

  ## Logging
  ErrorLog "/var/log/httpd/projects.cs.umd.edu_error.log"

  ## Rewrite rules
  RewriteEngine On

  #Show errors for missing sites
  RewriteCond %{HTTP_HOST} "^([^:/]*)(:.+)?" [NC]
  RewriteCond '/var/www/projects/_webroots/%1' !-d
  RewriteRule (.*) /default-site/index.php [L]


  UseCanonicalName Off
</VirtualHost>

@yakatz yakatz requested a review from a team as a code owner September 20, 2021 06:06
@CLAassistant
Copy link

CLAassistant commented Sep 20, 2021

CLA assistant check
All committers have signed the CLA.

@puppet-community-rangefinder
Copy link

apache::vhost is a type

that may have no external impact to Forge modules.

This module is declared in 173 of 578 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

Copy link
Contributor Author

@yakatz yakatz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

spec/defines/vhost_spec.rb Show resolved Hide resolved
Copy link
Member

@david22swan david22swan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@david22swan
Copy link
Member

@yakatz Thanks for putting in the work.
This looks good to me so I'm gonna go ahead and merge.
Looking forward to more from you in the future

@david22swan david22swan merged commit 4d3702e into puppetlabs:main Sep 27, 2021
@yakatz yakatz deleted the bug/docroot_with_vhostalias branch September 27, 2021 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants