<p>I'm dockerizing a laravel application, my image is based on an apache image, this is being hosted in AKS, where I'm mounting azure files with images share inside /public/images, the problem is apache would add header inside the image resulting in corrupting the images</p>
<p><a href="https://i.stack.imgur.com/vHkrz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vHkrz.png" alt="enter image description here" /></a></p>
<p>even if I exec inside the pod itself and try curl localhost, I get the same problem so I'm sure it's not a problem with routing or my ingress</p>
<pre><code>    FROM php:7.3-apache

#install all the system dependencies and enable PHP modules 
RUN apt-get update -y &amp;&amp; apt-get install -y libmcrypt-dev openssl
RUN apt-get update &amp;&amp; apt-get install -y libmcrypt-dev \
    &amp;&amp; pecl install mcrypt-1.0.2 \
    &amp;&amp; docker-php-ext-enable mcrypt
RUN docker-php-ext-install pdo mbstring 
RUN apt-get install -y \
        libzip-dev \
        zip \
  &amp;&amp; docker-php-ext-install zip
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev &amp;&amp; \
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
RUN docker-php-ext-install gd
RUN docker-php-ext-install mysqli pdo pdo_mysql
# RUN apt-get install wget
RUN apt-get update; apt-get install curl -y

#install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer

#set our application folder as an environment variable
ENV APP_HOME /var/www/html

#change uid and gid of apache to docker user uid/gid
RUN usermod -u 1000 www-data &amp;&amp; groupmod -g 1000 www-data

#change the web_root to laravel /var/www/html/public folder
#RUN sed -i -e &quot;s/html/html\/public/g&quot; /etc/apache2/sites-enabled/000-default.conf
COPY vhost.conf /etc/apache2/sites-available/000-default.conf
RUN echo &quot;EnableSendfile off&quot; &gt;&gt; /etc/apache2/apache2.conf


# enable apache module rewrite
RUN a2enmod rewrite

#copy source files and run composer
COPY . $APP_HOME

# install all PHP dependencies
RUN composer install --no-interaction


#change ownership of our applications
RUN chown -R www-data:www-data $APP_HOME
</code></pre>
<p>next using regular deployment yaml file to push this to kubernetes with the following Volume mounts:</p>
<pre><code>volumeMounts:
- name: sessions
  mountPath: /var/www/html/storage/framework/sessions
- name: cache
  mountPath: /var/www/html/storage/framework/cache
- name: views
  mountPath: /var/www/html/storage/framework/views
- name: images
  mountPath: /var/www/html/public/images
</code></pre>
<p>volumes:</p>
<ul>
<li>name: sessions
azureFile:
secretName: appmnt
shareName: sessions
readOnly: false</li>
<li>name: cache
azureFile:
secretName: appmnt
shareName: cache
readOnly: false</li>
<li>name: views
azureFile:
secretName: appmnt
shareName: views
readOnly: false</li>
<li>name: images
azureFile:
secretName: appmnt
shareName: images
readOnly: false</li>
</ul>
<p>now the problem is if i try to access a static file from images folder, by example using a url like &quot;https://www.somedomain.com/images/somefile.png&quot;</p>
<p>the file will be download but apache will attach the above headers to the content resulting in corruption.</p>
<p>the web applications work perfectly fine, except for any files inside the volume mounts.</p>
<p>if i do &quot;kubectl exec -it podname -- bash&quot; and browse the files i can see the volume mounts are working fine, also if i try to upload files from the application interface, the file gets written in the write way inside the folder, only problem is with browsing the file.</p>

Stacker
<p>We fixed the issue, simply in the vhost.conf, we needed to turn off EnableMMAP</p>
<pre><code>EnableMMAP off
</code></pre>
