Skip to content

Commit 981b702

Browse files
committed
Password-protect access to the Solr instance.
1 parent 39f3238 commit 981b702

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ services:
3030
- .env
3131
#volumes:
3232
# - solrdata:/var/solr:rw
33-
ports:
34-
- "8983:8983"
3533
networks:
3634
- tec-net
3735
command:

docker/nginx/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ RUN adduser -D -s /bin/false -G www-data www-data
1212
RUN mkdir -p /data/nginx/cache
1313

1414
RUN apk update \
15-
&& apk add --no-cache openssl \
15+
&& apk add --no-cache openssl apache2-utils \
1616
&& mkdir -p /tls/encryptioncompendium.org/
1717

18+
# Create an empty .htpasswd file for authentication
19+
RUN touch /etc/nginx/.htpasswd
20+
1821
# Add a custom run script
1922
COPY run.sh /run.sh
2023
CMD [ "/run.sh" ]

docker/nginx/conf.d/default.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ upstream encryption_compendium_server {
33
server tec-gunicorn:5000;
44
}
55

6+
upstream solr {
7+
server tec-search:8983;
8+
}
9+
610
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=60r/m;
711

812
server {
@@ -27,6 +31,16 @@ server {
2731
proxy_redirect off;
2832
}
2933

34+
location /solr/ {
35+
proxy_pass http://solr;
36+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
37+
proxy_set_header Host $host;
38+
proxy_redirect off;
39+
40+
auth_basic "Restricted Content";
41+
auth_basic_user_file /etc/nginx/.htpasswd;
42+
}
43+
3044
location /static/ {
3145
# Serve static files from Nginx since it's _significantly_ more performant
3246
# than having Gunicorn serve those files.

0 commit comments

Comments
 (0)