HTTP
Due to the characteristics of the HAP system architecture, when the system's access address changes as a result of configuring a proxy, you need to update the docker-compose.yaml configuration file accordingly.
As shown in the image below, modify the value of the ENV_ADDRESS_MAIN environment variable to reflect the actual access address of the HAP service. After completing the modification, restart the HAP service to apply the changes.

For earlier versions:
If your environment configuration does not yet define ENV_ADDRESS_MAIN, you should update the following three parameters instead: ENV_MINGDAO_PROTO, ENV_MINGDAO_HOST, and ENV_MINGDAO_PORT. The configuration logic remains consistent.
Nginx Configuration Example
If you need to access the HAP service via HTTP protocol using a proxy, you can refer to the following Nginx reverse proxy configuration example:
upstream hap {
server Server_IP:8880; # Replace with the internal IP and port of your HAP system
}
server {
listen 80;
server_name _;
access_log /data/logs/weblogs/hap.log main; # Log path can be customized
error_log /data/logs/weblogs/hap.error.log; # Log path can be customized
underscores_in_headers on;
client_max_body_size 2048m;
gzip on;
gzip_proxied any;
gzip_disable "msie6";
gzip_vary on;
gzip_min_length 512;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/json application/x-javascript application/javascript application/octet-stream text/xml application/xml application/xml+rss text/javascript image/jpeg image/gif image/png;
location / {
set $real_ip '';
if ($http_x_real_ip) {
set $real_ip $http_x_real_ip;
}
if ($http_x_real_ip = '') {
set $real_ip $remote_addr;
}
proxy_set_header X-Real-IP $real_ip;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://hap;
}
# Required for IM
location ~ /mds2 {
proxy_set_header Host $http_host;
proxy_hide_header X-Powered-By;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://hap;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
}
}
If you wish to configure a new access address while retaining the original access method, refer to Multiple Access Address Configuration.