Skip to content

Display of RewriteRule in vhost config files #2588

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

Open
teluq-pbrideau opened this issue Feb 25, 2025 · 1 comment
Open

Display of RewriteRule in vhost config files #2588

teluq-pbrideau opened this issue Feb 25, 2025 · 1 comment

Comments

@teluq-pbrideau
Copy link

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"
@teluq-pbrideau
Copy link
Author

It’s pretty basic change, the CR is wrongly placed in the template in my opinion, i’ll provide a quick PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant