Can I remove backslash from Url in ghost-ingress? (http://abc.example.com/blog1/ my task is to get: http://abc.example.com/blog1)

11/11/2021

I tried to change nginx.ingress.kubernetes.io/rewrite-target:/$2$3 to $2 or $3

path: /()(blog1)(.*) and pathType:Prefix to ImplementationSpecific but without any success.

I also tried to add nginx.ingress.kubernetes.io/configuration-snippet: rewrite ^(/blog1)$ $1/ permanent but again no success.

Is it possible to remove backslash from http://abc.example.com/blog1/ or is it Ghost specific thing?

My code as follows:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"kubernetes.io/ingress.class":"nginx","nginx.ingress.kubernetes.io/proxy-body-size":"0","nginx.ingress.kubernetes.io/proxy-read-timeout":"7500","nginx.ingress.kubernetes.io/proxy-send-timeout":"7500","nginx.ingress.kubernetes.io/rewrite-target":"/$2$3","nginx.ingress.kubernetes.io/ssl-redirect":"false"},"name":"ghost-ingress","namespace":"refactoring"},"spec":{"rules":[{"host":"abc.example.com","http":{"paths":[{"backend":{"serviceName":"ghost","servicePort":80},"path":"/()(blog1)(.*)","pathType":"ImplementationSpecific"}]}}]},"status":null}
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "7500"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "7500"
    nginx.ingress.kubernetes.io/rewrite-target: /$2$3
    nginx.ingress.kubernetes.io/ssl-redirect: "false"
  creationTimestamp: "2021-10-11T08:08:23Z"
  generation: 71
  managedFields:
  - apiVersion: extensions/v1beta1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .: {}
          f:kubernetes.io/ingress.class: {}
          f:nginx.ingress.kubernetes.io/proxy-body-size: {}
          f:nginx.ingress.kubernetes.io/proxy-read-timeout: {}
          f:nginx.ingress.kubernetes.io/proxy-send-timeout: {}
          f:nginx.ingress.kubernetes.io/ssl-redirect: {}
    manager: kubectl-client-side-apply
    operation: Update
    time: "2021-10-11T08:08:23Z"
  - apiVersion: networking.k8s.io/v1beta1
    fieldsType: FieldsV1
    fieldsV1:
      f:status:
        f:loadBalancer:
          f:ingress: {}
    manager: nginx-ingress-controller
    operation: Update
    time: "2021-10-11T08:08:51Z"
  - apiVersion: networking.k8s.io/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:spec:
        f:rules: {}
    manager: kubectl-edit
    operation: Update
    time: "2021-10-11T08:41:06Z"
  - apiVersion: extensions/v1beta1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          f:kubectl.kubernetes.io/last-applied-configuration: {}
          f:nginx.ingress.kubernetes.io/rewrite-target: {}
    manager: GoogleCloudConsole
    operation: Update
    time: "2021-11-11T20:04:06Z"
  name: ghost-ingress
  namespace: refactoring
  resourceVersion: "117190292"
  selfLink: /apis/extensions/v1beta1/namespaces/refactoring/ingresses/ghost-ingress
  uid: 84511a9e-2f83-438e-ae9b-e334dd3d5e8c
spec:
  rules:
  - host: abc.example.com
    http:
      paths:
      - backend:
          serviceName: ghost
          servicePort: 80
        path: /()(blog1)(.*)
        pathType: Prefix
status:
  loadBalancer:
    ingress:
    - ip: 10.4.8.167
-- Koryun
ghost-blog
kubernetes
nginx-ingress
target
url-rewriting

0 Answers