Skip to content

Commit

Permalink
rewrite to forwarded scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4c6565 committed Nov 22, 2023
1 parent a499dcb commit db7446e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
1 change: 0 additions & 1 deletion .ci/kustomize/base/app-ingress-ans.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ kind: Ingress
metadata:
name: app-ingress-ans
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
cert-manager.io/cluster-issuer: letsencrypt-http
spec:
rules:
Expand Down
2 changes: 0 additions & 2 deletions .ci/kustomize/base/app-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app-ingress
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- host: docs.ukfast.co.uk
Expand Down
2 changes: 0 additions & 2 deletions .ci/kustomize/overlays/uat/app-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app-ingress
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
rules:
- host: REPLACE_ME
Expand Down
27 changes: 16 additions & 11 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ http {
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.

map $http_x_forwarded_proto $http_scheme {
default "http";
https "https";
}

server {
listen 80 default_server;
listen [::]:80 default_server;
Expand All @@ -38,17 +43,17 @@ http {
proxy_pass http://elasticsearch:9200/;
}

rewrite ^(?!(\/docs|\/search))\/(.*)$ /docs/$2 permanent;
rewrite ^\/docs\/(((?!index).)*)\.html$ /docs/$1/ permanent;

rewrite ^/docs/cloud/(.*)$ /docs/ecloud/$1 permanent;
rewrite ^/docs/ecloud/hybridandprivate/(.*)$ /docs/ecloud/private/$1 permanent;
rewrite ^/docs/Domains/(.*)$ /docs/domains/$1 permanent;
rewrite ^/docs/ecommercestacks/magento/magento2/nginxphpfilewhitelist.html /docs/ecommercestacks/magento/magento2/nginxphpfileallowlist.html permanent;
rewrite ^/docs/operatingsystems/linux/mail/blacklists.html /docs/email/blocklists.html permanent;
rewrite ^/docs/security/threatmonitoring/alert-remediation-tips/ip-whitelist.html /docs/security/threatmonitoring/alert-remediation-tips/ip-allowlist.html permanent;
rewrite ^/docs/operatingsystems/linux/mail/(.*)$ /docs/email/$1 permanent;
rewrite ^/docs/operatingsystems/windows/hmail/antispamsetup.html /docs/email/hmail-antispam-setup.html permanent;
rewrite ^(?!(\/docs|\/search))\/(.*)$ $http_scheme://$host/docs/$2 permanent;
rewrite ^\/docs\/(((?!index).)*)\.html$ $http_scheme://$host/docs/$1/ permanent;

rewrite ^/docs/cloud/(.*)$ $http_scheme://$host/docs/ecloud/$1 permanent;
rewrite ^/docs/ecloud/hybridandprivate/(.*)$ $http_scheme://$host/docs/ecloud/private/$1 permanent;
rewrite ^/docs/Domains/(.*)$ $http_scheme://$host/docs/domains/$1 permanent;
rewrite ^/docs/ecommercestacks/magento/magento2/nginxphpfilewhitelist.html $http_scheme://$host/docs/ecommercestacks/magento/magento2/nginxphpfileallowlist.html permanent;
rewrite ^/docs/operatingsystems/linux/mail/blacklists.html $http_scheme://$host/docs/email/blocklists.html permanent;
rewrite ^/docs/security/threatmonitoring/alert-remediation-tips/ip-whitelist.html $http_scheme://$host/docs/security/threatmonitoring/alert-remediation-tips/ip-allowlist.html permanent;
rewrite ^/docs/operatingsystems/linux/mail/(.*)$ $http_scheme://$host/docs/email/$1 permanent;
rewrite ^/docs/operatingsystems/windows/hmail/antispamsetup.html $http_scheme://$host/docs/email/hmail-antispam-setup.html permanent;

location /docs/robots.txt {
alias /usr/share/nginx/docs.ukfast.co.uk/html/docs/_static/robots.txt;
Expand Down

0 comments on commit db7446e

Please sign in to comment.