@@ -25,12 +25,12 @@ echo "DEBUG, determined RESOLVERS from /etc/resolv.conf: '$RESOLVERS'"
25
25
conf=" "
26
26
for ONE_RESOLVER in ${RESOLVERS} ; do
27
27
echo " Possible resolver: $ONE_RESOLVER "
28
- conf=" resolver $ONE_RESOLVER ; "
28
+ conf=" resolver $ONE_RESOLVER ipv6=off ; "
29
29
done
30
30
31
31
echo " Final chosen resolver: $conf "
32
32
confpath=/etc/nginx/resolvers.conf
33
- if [ ! -e $confpath ]
33
+ if [ ! -e $confpath ] || [ " $conf " != " $( cat $confpath ) " ]
34
34
then
35
35
echo " Using auto-determined resolver '$conf ' via '$confpath '"
36
36
echo " $conf " > $confpath
@@ -147,6 +147,17 @@ echo -e "\nManifest caching config: ---\n"
147
147
cat /etc/nginx/nginx.manifest.caching.config.conf
148
148
echo " ---"
149
149
150
+ if [[ " a${ALLOW_OWN_AUTH} " == " atrue" ]]; then
151
+ cat << 'EOF ' > /etc/nginx/conf.d/allowed_override_auth.conf
152
+ if ($http_authorization != "") {
153
+ # override with own authentication if provided
154
+ set $finalAuth $http_authorization;
155
+ }
156
+ EOF
157
+ else
158
+ echo ' ' > /etc/nginx/conf.d/allowed_override_auth.conf
159
+ fi
160
+
150
161
if [[ " a${ALLOW_PUSH} " == " atrue" ]]; then
151
162
cat << EOF > /etc/nginx/conf.d/allowed.methods.conf
152
163
# allow to upload big layers
@@ -155,6 +166,31 @@ if [[ "a${ALLOW_PUSH}" == "atrue" ]]; then
155
166
# only cache GET requests
156
167
proxy_cache_methods GET;
157
168
EOF
169
+ elif [[ " a${ALLOW_PUSH_WITH_OWN_AUTH} " == " atrue" ]]; then
170
+ cat << 'EOF ' > /etc/nginx/conf.d/allowed.methods.conf
171
+ # Block POST/PUT/DELETE if own authentication is not provided.
172
+ set $combined_ha_rm "$http_authorization$request_method";
173
+ if ($combined_ha_rm = POST) {
174
+ return 405 "POST method is not allowed";
175
+ }
176
+ if ($combined_ha_rm = PUT) {
177
+ return 405 "PUT method is not allowed";
178
+ }
179
+ if ($combined_ha_rm = DELETE) {
180
+ return 405 "DELETE method is not allowed";
181
+ }
182
+
183
+ if ($http_authorization != "") {
184
+ # override with own authentication if provided
185
+ set $finalAuth $http_authorization;
186
+ }
187
+
188
+ # allow to upload big layers
189
+ client_max_body_size 0;
190
+
191
+ # only cache GET requests
192
+ proxy_cache_methods GET;
193
+ EOF
158
194
else
159
195
cat << 'EOF ' > /etc/nginx/conf.d/allowed.methods.conf
160
196
# Block POST/PUT/DELETE. Don't use this proxy for pushing.
0 commit comments