From d8d1d34f475957e641cb23d2953a676e5186b0d5 Mon Sep 17 00:00:00 2001 From: Arthur Wang Date: Sat, 9 Mar 2024 21:42:04 -0500 Subject: [PATCH] Fix Mixed Content bug --- .htaccess | 3 +++ Dockerfile | 6 ++++- notes.md | 67 ++++++++++-------------------------------------------- 3 files changed, 20 insertions(+), 56 deletions(-) create mode 100644 .htaccess diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..3c98d38 --- /dev/null +++ b/.htaccess @@ -0,0 +1,3 @@ + +Header always set Content-Security-Policy "upgrade-insecure-requests;" + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5a385ea..5e6ee9d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.18 LABEL maintainer="Public Knowledge Project " -WORKDIR /var/www/html +# WORKDIR /var/www/html # When using Composer, disable the warning about running commands as root/super user ENV COMPOSER_ALLOW_SUPERUSER=1 \ @@ -127,6 +127,10 @@ RUN set -xe \ && find . -name "test" -exec rm -Rf '{}' \; \ && find . \( -name .gitignore -o -name .gitmodules -o -name .keepme \) -exec rm -Rf '{}' \; +# Fix mixed content issue +COPY .htaccess /var/www/html/ +RUN sed -i 's@^#LoadModule headers_module modules/mod_headers\.so@LoadModule headers_module modules/mod_headers.so@' /etc/apache2/httpd.conf + # Enable ssh COPY sshd_config /etc/ssh/ COPY entrypoint.sh /var/www/html/ diff --git a/notes.md b/notes.md index 542238d..9599fd8 100644 --- a/notes.md +++ b/notes.md @@ -19,61 +19,9 @@ https://learn.microsoft.com/en-us/azure/app-service/tutorial-multi-container-app - part of that involves customizing the docker image -## Instructions on adding SSH from Microsoft forum +## Adding SSH to Azure App Service Container - + Examples: https://github.com/azureossd/docker-container-ssh-examples - - -### Docker File: - -FROM node:lts-alpine -ENV NODE_ENV=production -WORKDIR /usr/src/app -COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*","sshd_config","entrypoint.sh", "./"] -RUN npm install --production --silent && mv node_modules ../ -COPY sshd_config /etc/ssh/ - - -# Start and enable SSH -RUN apk add openssh \ - && echo "root:Docker!" | chpasswd \ - && chmod +x //usr/src/app/entrypoint.sh \ - && cd /etc/ssh/ \ - && ssh-keygen -A -COPY . . -EXPOSE 3000 2222 -#RUN chown -R node /usr/src/app -#USER node -ENTRYPOINT [ "/usr/src/app/entrypoint.sh" ] - - -### sshd_config: - - - - - - +- [Troubleshooting](https://azureossd.github.io/2022/04/27/2022-Enabling-SSH-on-Linux-Web-App-for-Containers/index.html#troubleshooting) https://github.com/actions/checkout/discussions/928#discussioncomment-3871262 @@ -81,4 +29,13 @@ https://github.com/actions/checkout/discussions/928#discussioncomment-3871262 https://github.com/actions/checkout/issues/116#issuecomment-644419389 -https://thenewstack.io/how-to-trigger-github-actions-on-submodule-updates/#:~:text=First%2C%20you%20can%20choose%20how,out%20on%20the%20parent%20REPOSITORY%20. \ No newline at end of file +https://thenewstack.io/how-to-trigger-github-actions-on-submodule-updates/#:~:text=First%2C%20you%20can%20choose%20how,out%20on%20the%20parent%20REPOSITORY%20. + + +## Mixed Content issue +Need to enable apache's mod_headers +then add the following to .htaccess + + +Header always set Content-Security-Policy "upgrade-insecure-requests;" + \ No newline at end of file