Add a custom HTTPD config to log X-Forwarded-For IP

This commit is contained in:
Maciej Pędzich 2024-08-16 09:35:58 +02:00
parent 6ef1e30039
commit 6e1d3e864c
Signed by: maciejpedzich
GPG Key ID: CE4A303D84882F0D
2 changed files with 7 additions and 0 deletions

View File

@ -5,5 +5,6 @@ RUN npm i
RUN npm run build RUN npm run build
FROM httpd:2.4-alpine AS runtime FROM httpd:2.4-alpine AS runtime
COPY --from=build httpd.conf /usr/local/apache2/conf/httpd.conf
COPY --from=build /app/dist /usr/local/apache2/htdocs/ COPY --from=build /app/dist /usr/local/apache2/htdocs/
EXPOSE 80 EXPOSE 80

6
httpd.conf Normal file
View File

@ -0,0 +1,6 @@
# Fields to record - use X-Forward-For instead of client IP so that we get the actual clients IP
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" mycustom
# Log locations
CustomLog "/var/log/httpd/access.log" mycustom env=!dontlog
ErrorLog "/var/log/httpd/error.log"