File tree 3 files changed +28
-10
lines changed
3 files changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -94,5 +94,8 @@ ENV MANIFEST_CACHE_SECONDARY_TIME="60d"
94
94
# In the default config, :latest and other frequently-used tags will get this value.
95
95
ENV MANIFEST_CACHE_DEFAULT_TIME="1h"
96
96
97
+ # Should we allow actions different than pull, default to false.
98
+ ENV ALLOW_PUSH="false"
99
+
97
100
# Did you want a shell? Sorry, the entrypoint never returns, because it runs nginx itself. Use 'docker exec' if you need to mess around internally.
98
101
ENTRYPOINT ["/entrypoint.sh" ]
Original file line number Diff line number Diff line change @@ -121,6 +121,29 @@ echo "Manifest caching config: ---"
121
121
cat /etc/nginx/nginx.manifest.caching.config.conf
122
122
echo " ---"
123
123
124
+ if [[ " a${ALLOW_PUSH} " == " atrue" ]]; then
125
+ cat << EOF > /etc/nginx/conf.d/allowed.methods.conf
126
+ # allow to upload big layers
127
+ client_max_body_size 0;
128
+
129
+ # only cache GET requests
130
+ proxy_cache_methods GET;
131
+ EOF
132
+ else
133
+ cat << 'EOF ' > /etc/nginx/conf.d/allowed.methods.conf
134
+ # Block POST/PUT/DELETE. Don't use this proxy for pushing.
135
+ if ($request_method = POST) {
136
+ return 405 "POST method is not allowed";
137
+ }
138
+ if ($request_method = PUT) {
139
+ return 405 "PUT method is not allowed";
140
+ }
141
+ if ($request_method = DELETE) {
142
+ return 405 "DELETE method is not allowed";
143
+ }
144
+ EOF
145
+ fi
146
+
124
147
# normally use non-debug version of nginx
125
148
NGINX_BIN=" /usr/sbin/nginx"
126
149
Original file line number Diff line number Diff line change @@ -219,16 +219,8 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
219
219
# Docker needs this. Don't ask.
220
220
chunked_transfer_encoding on ;
221
221
222
- # Block POST/PUT/DELETE. Don't use this proxy for pushing.
223
- if ($request_method = POST) {
224
- return 405 "POST method is not allowed" ;
225
- }
226
- if ($request_method = PUT) {
227
- return 405 "PUT method is not allowed" ;
228
- }
229
- if ($request_method = DELETE) {
230
- return 405 "DELETE method is not allowed" ;
231
- }
222
+ # configuration of the different allowed methods
223
+ include "/etc/nginx/conf.d/allowed.methods.conf" ;
232
224
233
225
proxy_read_timeout 900 ;
234
226
You can’t perform that action at this time.
0 commit comments