puppetlabs / puppetlabs/puppetlabs-apache

Display of RewriteRule in vhost config files

Open
#2,588 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Puppet
Stars
356
Forks
1.1k
Avg merge
3m
Merged PRs (30d)
1

Description

Use Case

When I define multiple RewriteRule, they are not very well displayed in the config file, there is too much space between them and there is no sense they are related to each other…

  apache::vhost { 'example.com':
    rewrites => [
      {
        comment => 'Example rules 1',
        rewrite_rule => [
          '"\/(foo\/)" - [F]',
          '"\/(bar\/)" - [F]',
          '"\/(baz\/)" - [F]',
          '"\/(qux\/)" - [F]',
          '"\/(quux\/)" - [F]',
        ],
      },
      {
        comment => 'Example rules 2',
        rewrite_rule => [
          '"\/(another_foo\/)" - [F]',
          '"\/(another_bar\/)" - [F]',
          '"\/(another_baz\/)" - [F]',
          '"\/(another_qux\/)" - [F]',
          '"\/(another_quux\/)" - [F]',
        ],
      },
    ],
  }
[...]
  # Example rules 1
  RewriteRule "(\/foo\/)" - [F]

  RewriteRule "(\/bar\/)" - [F]

  RewriteRule "(\/baz\/)" - [F]

  RewriteRule "(\/qux\/)" - [F]

  RewriteRule "(\/quux\/)" - [F]

  # Example rules 2
  RewriteRule "(\/another_foo\/)" - [F]

  RewriteRule "(\/another_bar\/)" - [F]

  RewriteRule "(\/another_baz\/)" - [F]

  RewriteRule "(\/another_qux\/)" - [F]

  RewriteRule "(\/another_quux\/)" - [F]

Describe the Solution You Would Like

I feel these RewriteRule should not be this much spaced. I think this would be much more readable:

  # Example rules 1
  RewriteRule "(\/foo\/)" - [F]
  RewriteRule "(\/bar\/)" - [F]
  RewriteRule "(\/baz\/)" - [F]
  RewriteRule "(\/qux\/)" - [F]
  RewriteRule "(\/quux\/)" - [F]

  # Example rules 2
  RewriteRule "(\/another_foo\/)" - [F]
  RewriteRule "(\/another_bar\/)" - [F]
  RewriteRule "(\/another_baz\/)" - [F]
  RewriteRule "(\/another_qux\/)" - [F]
  RewriteRule "(\/another_quux\/)" - [F]

Describe Alternatives You've Considered

Not caring about how the config file looks!

Additional Context

Other related config seems grouped together, for example when there is TLS config:

  ## SSL directives
  SSLEngine on
  SSLCertificateFile      "/etc/pki/tls/certs/example.com.crt"
  SSLCertificateKeyFile   "/etc/pki/tls/private/example.com.key"
  SSLCACertificateFile    "/etc/pki/tls/certs/ca-bundle.crt"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the apache::vhost rendering path for the rewrites and rewrite_rule settings, then compare the generated configuration with the examples in this issue. Done means consecutive RewriteRule directives within each commented group have no blank lines between them, while separate groups retain one blank line.

Written by the indexing model from the issue text.

Assessment

Tech stack
apache
Domain
infrastructure
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.