Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add portal https guide #4676

Merged
merged 1 commit into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions docs/en/faq/common-issues-in-deployment-and-development-phase.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,51 @@ location /apollo/ {
proxy_pass http://127.0.0.1:8070/;
}
```

### 17. How to configure https after Portal is mounted to nginx/slb?

1. configure https access configuration on nginx/slb, taking nginx as an example:

```
nobodyiam marked this conversation as resolved.
Show resolved Hide resolved
server {
listen 80 default_server;
location / {
# redirect all requests on port 80 to https
return 301 https://$http_host$request_uri;
}
}
server {
# If the nginx version is lower and does not support http2, configure listen 443 ssl;
listen 443 ssl http2;
server_name your-domain-name;
# ssl certificate, nginx needs to use a certificate with a complete certificate chain
ssl_certificate /etc/nginx/ssl/xxx.crt;
ssl_certificate_key /etc/nginx/ssl/xxx.key;
location / {
proxy_pass http://apollo-portal-address:8070;
proxy_set_header x-real-ip $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
#! ! ! This must be $http_host, if it is configured as $host, the port will be wrong when redirecting
proxy_set_header host $http_host;
proxy_set_header x-forwarded-proto $scheme;
proxy_http_version 1.1;
}
}
```

2. Configure apollo-portal to parse the header information from the reverse proxy

vdiskg marked this conversation as resolved.
Show resolved Hide resolved
Modify application-github.properties under the config directory in the apollo-portal installation package and add the following configuration:

```properties
server.forward-headers-strategy=framework
```

It can also be configured through environment variables:

```
SERVER_FORWARD_HEADERS_STRATEGY=framework
```
50 changes: 49 additions & 1 deletion docs/zh/faq/common-issues-in-deployment-and-development-phase.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,52 @@ location /apollo/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8070/;
}
```
```

### 17. Portal挂载到nginx/slb后如何配置https?

1. 在nginx/slb上配置https访问配置,以nginx为例:

```
nobodyiam marked this conversation as resolved.
Show resolved Hide resolved
server {
listen 80 default_server;
location / {
# 把 80 端口的请求全部都重定向到 https
return 301 https://$http_host$request_uri;
}
}
server {
# nginx 版本较低不支持 http2 的, 则配置 listen 443 ssl;
listen 443 ssl http2;
server_name your-domain-name;
# ssl 证书, nginx 需要使用完整证书链的证书
ssl_certificate /etc/nginx/ssl/xxx.crt;
ssl_certificate_key /etc/nginx/ssl/xxx.key;
location / {
proxy_pass http://apollo-portal-address:8070;
proxy_set_header x-real-ip $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
# !!!这里必须是 $http_host, 如果配置成 $host 会导致跳转的时候端口错误
proxy_set_header host $http_host;
proxy_set_header x-forwarded-proto $scheme;
proxy_http_version 1.1;
}
}
```

2. 配置apollo-portal解析反向代理的header信息

修改apollo-portal安装包中config目录下的application-github.properties,增加以下配置:

```properties
server.forward-headers-strategy=framework
```

也可以通过环境变量配置:

```
SERVER_FORWARD_HEADERS_STRATEGY=framework
```