You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@zeppelin.apache.org by Scarlet Frank <sc...@outlook.com> on 2021/10/16 03:43:56 UTC

回复: how to bypass the port 9000 barrier [zeppelin with nginx]

The mailto request made by 'reply via mail client' failed on my Edge Browser. So I have to reply it myself.

So the key to the problem is 'base-url.service.js'.  An if clause inside the function called 'this.getPort':
```js
     // Exception for when running locally via grunt
     if (port === process.env.WEB_PORT) {
       port = process.env.SERVER_PORT;
     }
```
So the default if clause becomes `if (port === 9000) port = 8080;`

I try to  comment this clause and compile again. Replaced the js in the origin war and It works ! Websocket connections and API requests will send to 9000 port. Now zeppelin serves on 8080 and nginx listens on 9000.

发件人: Scarlet Frank
发送时间: 2021年10月15日 10:11
收件人: 'users@zeppelin.apache.org' <us...@zeppelin.apache.org>
主题: how to bypass the port 9000 barrier [zeppelin with nginx]

Hi !
I recently tried to set up zeppelin with nginx. My initial plan was like “zeppelin serves on port 8080 and nginx listens on port 9000”
It immediately comes up with a problem that both websocket and API requests are sent to port 8080. The problem disappears when I change the nginx listen port from 9000 to 9001.
In Zeppelin Configuration<https://zeppelin.apache.org/docs/0.10.0/setup/operation/configuration.html> page, it says that zeppelin server port should not be the same with zeppelin web application development port.
My Aim:

1.      visit production:9000/zeppelin/ to access zepnode:8080 (zeppelin server). Port is constrained in production environment.
Questions:

1.      Does this rule also apply to nginx reverse proxy ? (port != 9000).

2.      Is it hard-coded in zeppelin-web project (9000 port for web application development) or I could change a config in the project and build a custom war myself?
My configurations are list below:

-       zeppelin/conf/zeppelin-site.xml
<property>
  <name>zeppelin.server.port</name>
  <value>8067</value>
  <description>Server port.</description>
</property>

-       nginx/site-available/zeppelin.conf
upstream zeppelin {
        server 127.0.0.1:8067;
}
# Zeppelin Website
server {
              # 9000 before
        listen 9001;
        location / {
                proxy_pass http://zeppelin;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_set_header X-NginX-Proxy true;
                proxy_redirect off;
                #auth_basic "Restricted";
                #auth_basic_user_file /etc/nginx/.htpasswd;
        }
        location /ws {
                proxy_pass http://zeppelin/ws;
                proxy_http_version 1.1;
                proxy_set_header Upgrade websocket;
                proxy_set_header Connection upgrade;
                proxy_read_timeout 86400;
        }
}
Did anyone encounter a similar issue?
I can provide more details if needed. :D
Some references:
Apache Zeppelin 0.10.0 Documentation: HTTP Basic Auth using NGINX<https://zeppelin.apache.org/docs/0.10.0/setup/security/authentication_nginx.html>
Thanks,
Scarlet