The JSON String passed as the nginxjson argument is a map of all container services which should be exposed trough the reverse proxy.
Each service has a list of section names which get redirected to that service.
The name defines this section under which the service will be available. If for example this is set to dashboard all requests coming to https://<device ip>/dashboard/
and all subpaths will be reverse proxied to the service.
If a service should be not be available under a direct string an additonal path can be added using the subpath argument. If we set it to foo/bar for example, the service would be available under https://<device ip>/dashboard/foo/bar/
.
In the protocol field it is determined if incoming https requests should be terminated at the reverse proxy ("HTTP") and forwarded unencrypted or another secure connection should forward the traffic encrypted to the service.
The port defines the to which port of the service should be passed to. The port can not be exposed to the host at the same time.
With rewriteTarget it is determined how incoming requests get rewritten. If set to the default "/", requests get passed to the root. Any subdirectories after the name and subpath will then get passed along. If the rewriteTarget is for example set to "/baz" an incoming requests to https://<device ip>/dashboard/foo/bar/file.txt
will be forwarded to the service as http://<service ip>/baz/file.txt
.
isSecureRedirection allows only authenticated traffic to be redirected to your service.
When bypassUrlDecoding is set, all requests will be forwarded to the service without rewriting the request without the name and subpath.
If your application requires special proxy directives to be set they can added as an encoded json string in headers.
Tip
To pass informations about the request to the service a number of headers like X-Forwarded-For
, X-Forwarded-Proto
and X-Forwarded-Host
can be used using the proxy_set_header directive.
An example nginxjson could look like the following, including a lot of recommended proxy directives:
{
"servicename": [
{
"name": "nginx",
"protocol": "HTTP",
"port": "80",
"headers": "{\"proxy_http_version\":\"1.1\",\"proxy_set_header Upgrade\":\"$http_upgrade\",\"proxy_set_header Connection\":\"\\\"upgrade\\\"\",\"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-Proto\":\"$scheme\",\"proxy_set_header X-Forwarded-Host\":\"$host\",\"proxy_set_header X-Forwarded-Port\":\"$server_port\"}",
"rewriteTarget": "/",
"subPath": "",
"isSecureRedirection": false,
"bypassUrlDecoding": false
}
]
}
Info
- proxy_bind
- proxy_buffer_size
- proxy_buffering
- proxy_buffers
- proxy_busy_buffers_size
- proxy_cache
- proxy_cache_background_update
- proxy_cache_bypass
- proxy_cache_convert_head
- proxy_cache_key
- proxy_cache_lock
- proxy_cache_lock_age
- proxy_cache_lock_timeout
- proxy_cache_max_range_offset
- proxy_cache_methods
- proxy_cache_min_uses
- proxy_cache_purge
- proxy_cache_revalidate
- proxy_cache_use_stale
- proxy_cache_valid
- proxy_connect_timeout
- proxy_cookie_domain
- proxy_cookie_flags
- proxy_cookie_path
- proxy_force_ranges
- proxy_headers_hash_bucket_size
- proxy_headers_hash_max_size
- proxy_hide_header
- proxy_http_version
- proxy_ignore_client_abort
- proxy_ignore_headers
- proxy_intercept_errors
- proxy_limit_rate
- proxy_max_temp_file_size
- proxy_method
- proxy_next_upstream
- proxy_next_upstream_timeout
- proxy_next_upstream_tries
- proxy_no_cache
- proxy_pass_header
- proxy_pass_request_body
- proxy_pass_request_headers
- proxy_read_timeout
- proxy_redirect
- proxy_request_buffering
- proxy_send_lowat
- proxy_send_timeout
- proxy_set_body
- proxy_set_header
- proxy_socket_keepalive
- proxy_ssl_certificate
- proxy_ssl_certificate_key
- proxy_ssl_ciphers
- proxy_ssl_conf_command
- proxy_ssl_crl
- proxy_ssl_name
- proxy_ssl_password_file
- proxy_ssl_protocols
- proxy_ssl_server_name
- proxy_ssl_session_reuse
- proxy_ssl_trusted_certificate
- proxy_ssl_verify
- proxy_ssl_verify_depth
- proxy_store
- proxy_store_access
- proxy_temp_file_write_size
- proxy_temp_path
Info
More explanation about Reverse Proxy options can be found in the Industrial Edge App Publisher Docs under Configuring the Network Page.