robjam
robjam

Reputation: 989

Web App for Containers - Wordpress Https

I can't seem to get Web App for Containers (S1) to deploy a Wordpress image from Azure Container Instance with HTTPS working for the admin section. The wp-config.php configuration file are taken from the samples on github provided by microsoft and the Dockerfile is extended from wordpress:4.9.5-php7.2-apache

# Pull image from official source with version specified
FROM wordpress:4.9.5-php7.2-apache

# Overwrite Wordpress configuration
COPY ./wp-config.php /usr/src/wordpress/

# Add permissions needed for wordpress to run
RUN chown -R www-data:www-data /usr/src/wordpress/
WORKDIR /var/www/html

I can build the image, push it, and deploy it to Web App for Containers, but when I try to log into the admin portal using https I am redirected to the non-https login.

The docker logs on Web App during container invokation looks like below
2018-04-23 07:57:21.751 INFO  - Starting container for site
2018-04-23 07:57:21.751 INFO  - docker run -d -p 58688:80 --name my-test-website__c20c_2 -e WEBSITE_SITE_NAME=my-test-website-name -e WEBSITE_AUTH_ENABLED=False -e PORT=80 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_INSTANCE_ID=...3cfaeb147447885bccba4565fb6192f -e HTTP_LOGGING_ENABLED=1 myacrregsitryhere.azurecr.io/wordpressdocker:21483

Things that I have tried:

allow http/s in wp-config like so:

define('WP_HOME', '//'. filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING));
define('WP_SITEURL', '//'. filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING));
define('WP_CONTENT_URL', '/wp-content');
define('DOMAIN_CURRENT_SITE', filter_input(INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING));

which results in redirect loop that is stopped by the browser.

Azure Web app enforce https results in redirect loop that is stopped by the browser.

Enforce ssl via wp-config.php

define('FORCE_SSL_ADMIN', true);

How am I supposed to get https working with slots in Azure Web App for Containers?

Upvotes: 2

Views: 653

Answers (1)

huysmania
huysmania

Reputation: 1064

You can enforce SSL for that web app in the portal, i.e. as per https://learn.microsoft.com/en-gb/azure/app-service/app-service-web-tutorial-custom-ssl#enforce-https

Upvotes: 1

Related Questions