r/gitea: Handle encoded / characters in HTTP paths
Gitea package names (e.g. OCI images, etc.) can contain `/` charactres. These are encoded as %2F in request paths. Apache needs to forward these sequences to the Gitea server without decoding them. Unfortunately, the `AllowEncodedSlashes` setting, which controls this behavior, is a per-virtualhost setting that is *not* inherited from the main server configuration, and therefore must be explicitly set inside the `VirtualHost` block. This means Gitea needs its own virtual host definition, and cannot rely on the default virtual host.
This commit is contained in:
25
roles/gitea/templates/gitea.httpd.conf.j2
Normal file
25
roles/gitea/templates/gitea.httpd.conf.j2
Normal file
@@ -0,0 +1,25 @@
|
||||
# vim: set ft=apache :
|
||||
RewriteEngine on
|
||||
RewriteCond %{HTTPS} !on
|
||||
RewriteRule /.* https://%{SERVER_NAME}$0 [R=301,L]
|
||||
|
||||
<VirtualHost _default_:443>
|
||||
ServerName {{ gitea_http_domain }}
|
||||
|
||||
SSLCertificateFile {{ gitea_ssl_certificate }}
|
||||
SSLCertificateKeyFile {{ gitea_ssl_certificate_key }}
|
||||
SSLCertificateChainFile {{ gitea_ssl_certificate }}
|
||||
|
||||
RewriteEngine On
|
||||
RewriteCond %{HTTPS} !on
|
||||
RewriteRule /.* https://%{SERVER_NAME}$0
|
||||
|
||||
Header always set \
|
||||
Strict-Transport-Security "max-age=63072000; includeSubDomains"
|
||||
|
||||
ProxyPreserveHost On
|
||||
ProxyRequests Off
|
||||
ProxyPass / http://localhost:3000/ nocanon
|
||||
ProxyPassReverse / http://localhost:3000/
|
||||
AllowEncodedSlashes NoDecode
|
||||
</VirtualHost>
|
||||
Reference in New Issue
Block a user