Overview

When implementing CORS configuration for a Docker-based Omeka S as described in the following article, a server error occurred. This is a memo about that issue.

Dockerfile

The target is a Dockerfile like the following.

FROM php:apache

LABEL maintainer="Satoru Nakamura <na.kamura.1263@gmail.com>"

RUN a2enmod rewrite

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get -qq update && apt-get -qq -y upgrade
RUN apt-get install -y \
    zlib1g-dev \
    libpng-dev \
    libjpeg-dev \
    libfreetype6-dev \
    imagemagick \
    unzip \
    wget


# PHP extensions
RUN docker-php-ext-install -j$(nproc) iconv pdo pdo_mysql mysqli gd
RUN docker-php-ext-configure gd --with-jpeg=/usr/include/ --with-freetype=/usr/include/

# Download Omeka-s
ARG version=4.1.1
RUN wget https://github.com/omeka/omeka-s/releases/download/v${version}/omeka-s-${version}.zip -O /var/www/omeka-s-${version}.zip \
&& unzip -q /var/www/omeka-s-${version}.zip -d /var/www/ \
&& rm /var/www/omeka-s-${version}.zip \
&& rm -rf /var/www/html/ \
&& mv /var/www/omeka-s/ /var/www/html/

COPY ./.htaccess /var/www/html/.htaccess

# Configure volumes and permissions
COPY ./database.ini /var/www/html/volume/config/
RUN mkdir -p /var/www/html/volume/files/ \
&& rm /var/www/html/config/database.ini \
&& ln -s /var/www/html/volume/config/database.ini /var/www/html/config/database.ini \
&& rm -Rf /var/www/html/files/ \
&& ln -s /var/www/html/volume/files/ /var/www/html/files \
&& chown -R www-data:www-data /var/www/html/ \
&& find /var/www/html/volume/ -type f -exec chmod 600 {} \;

VOLUME /var/www/html/volume/

CMD ["apache2-foreground"]

Cause and Solution

The following line needed to be added.

RUN a2enmod headers

Summary

I hope this helps anyone experiencing the same issue.