Skip to content

My JavaScript Page is returning blank via the Nginx Ingress #925

@afsilvasantos

Description

@afsilvasantos

Hi Guys.
So i was just configuring my nginx ingress, and after making a HTTPS service accessible with HTTPS, i am now facing another problem. The IP and path are resolved and the service returns the webpage (if i inspect the element, it shows the same source code as the a working page i have in another location).
However, it seems that the page internally is not handling the paths well.
So my app works as follows:
https://app-container:portA/mandatory_path
returns the desired behaviour.
So i configured a Service with portB that connects to the application on portA. Within the cluster, if i access service_name:portB/mandatory_path it will load the page as expected.

No on my ingress i configured it like this (note that it has https end to end):

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: cafe-ingress
  namespace: namespacetest
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.org/server-snippets: "server_name ~^.*$;"
    nginx.org/ssl-services: "service-remote-manager-frontend"
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  tls:
  - hosts:
    - cafe.example.com
    secretName: cafe-secret
  rules:
  - host: cafe.example.com
    http:
      paths:
      - path: /tea
        backend:
          serviceName: tea-svc
          servicePort: 80
      - path: /coffee
        backend:
          serviceName: coffee-svc
          servicePort: 80
      - path: /target_location
        backend:
          serviceName: service_name
          servicePort: portB

On the browser i see this in the console:
client.js” was loaded despite its MIME type (“text/html”) not being a valid JavaScript MIME type
...
ReferenceError: rwt is not defined

So now i don't know if there is anything i can change on the path configurations, or if i have to change the web application which i did not develop.

On the Nginx contoller the configuration for this location shows like this:

upstream upstream_name {
      server 10.240.0.51:portA max_fails=1 fail_timeout=10s max_conns=0;
}
 location /target_location{


                proxy_http_version 1.1;


                proxy_connect_timeout 60s;
                proxy_read_timeout 60s;
                proxy_send_timeout 60s;
                client_max_body_size 1m;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Host $host;
                proxy_set_header X-Forwarded-Port $server_port;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_buffering on;

                proxy_pass https://upstream_name;


        }

Thanks in advance for the patience!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions