charts icon indicating copy to clipboard operation
charts copied to clipboard

wordpressScheme=https causes wordpress to hang when waiting for ready status

Open karezza opened this issue 5 years ago • 4 comments

Which chart: wordpress/5.8.1

Describe the bug Setting value of wordpressScheme=https causes wordpress to hang when waiting for ready status

To Reproduce I used the following in my values.yaml when performing helm install:

wordpressScheme: https
ingress:
  ingressClassName: nginx
  enabled: true
  hostname: www.travisloyd.xyz
  tls: true
  annotations:
    nginx.ingress.kubernetes.io/proxy-body-size: 1024m
    cert-manager.io/cluster-issuer: letsencrypt

Expected behavior I want my WP_HOME and WP_SITEURL to be https://www.travisloyd.xyz, rather than http://www.travisloyd.xyz and expected wordpressScheme to produce this result.

Version of Helm and Kubernetes:

  • Output of helm version:
version.BuildInfo{Version:"v3.6.3", GitCommit:"d506314abfb5d21419df8c7e7e68012379db2354", GitTreeState:"clean", GoVersion:"go1.16.5"}
  • Output of kubectl version:
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.3", GitCommit:"ca643a4d1f7bfe34773c74f79527be4afd95bf39", GitTreeState:"clean", BuildDate:"2021-07-15T21:04:39Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.1", GitCommit:"632ed300f2c34f6d6d15ca4cef3d3c7073412212", GitTreeState:"clean", BuildDate:"2021-08-19T15:39:34Z", GoVersion:"go1.16.7", Compiler:"gc", Platform:"linux/amd64"}

Additional context

  1. If I leave out wordpressScheme everything works as expected but WP_HOME & WP_SITEURL are set with http instead of https. (this appears under tools -> site health status)
You are accessing this website using HTTPS, but your WordPress Address and Site Address are not set up to use HTTPS by default.

HTTPS is already supported for your website.

However, your WordPress Address is currently controlled by a PHP constant and therefore cannot be updated. You need to edit your wp-config.php and remove or update the definitions of WP_HOME and WP_SITEURL.
  1. I'm using a third party tool to interact with my wp site and its using these values to try and connect. Since http is specified instead of https it fails to connect.

karezza avatar Sep 10 '21 16:09 karezza

Hi @karezza,

There aren't environments variables for WP_HOME and WP_SITEURL. Could you check this post? https://github.com/bitnami/charts/issues/5654#issuecomment-789541327

Mauraza avatar Sep 13 '21 07:09 Mauraza

@karezza,

I also encountered this bug.

kubectl describe pod $wp_pod
...
Warning  Unhealthy  37s (x4418 over 12h)  kubelet  Readiness probe failed: Get "https://10.0.31.229:8080/wp-login.php": http: server gave HTTP response to HTTPS client

To work around this bug, try setting the scheme to https and then configure custom livenessProbe and readinessProbe with https, ie:

# values.yaml

wordpressScheme: https

customLivenessProbe:
  enabled: true
  httpGet:
    path: /wp-admin/install.php
    port: https
    scheme: HTTPS
    httpHeaders: []
  initialDelaySeconds: 120 
  periodSeconds: 10
  timeoutSeconds: 5
  failureThreshold: 6
  successThreshold: 1

customReadinessProbe:
  enabled: true
  httpGet:
    path: /wp-login.php
    port: https
    scheme: HTTPS
    httpHeaders: []
  initialDelaySeconds: 30
  periodSeconds: 10
  timeoutSeconds: 5
  failureThreshold: 6
  successThreshold: 1

The issue appears to be that the readiness probe is sending an https request to the http port on the container. This will fix that and send an HTTPS request to an HTTPS port. Once you deploy the custom readiness/liveness probes, you should see updated checks:

kubectl describe pod $wp_pod
...
    Liveness:   http-get https://:https/wp-admin/install.php delay=120s timeout=5s period=10s #success=1 #failure=6
    Readiness:  http-get https://:https/wp-login.php delay=30s timeout=5s period=10s #success=1 #failure=6

This works for me.

itsecureadmin avatar Sep 15 '21 01:09 itsecureadmin

Hi @karezza,

Thanks for the contribution!! We will check the PR!

Mauraza avatar Sep 15 '21 06:09 Mauraza

I attempted the above without success, 'wordpressScheme' still seems to break things, and so I think there is a bug, but marking this as closed because I found a work around ... using a third party tool to port my website & it had a method to change all occurrences of my http website to https. (for anyone interested the third party tool was wpmudev.org and I used the package move method rather than the api, which doesn't work using this helm chart)

karezza avatar Sep 15 '21 15:09 karezza