Skip to content

WP-6869: Allow unrestricted domain and root path#86

Open
KharchenkoMaks wants to merge 4 commits intodevelopmentfrom
remove_domain
Open

WP-6869: Allow unrestricted domain and root path#86
KharchenkoMaks wants to merge 4 commits intodevelopmentfrom
remove_domain

Conversation

@KharchenkoMaks
Copy link
Contributor

@KharchenkoMaks KharchenkoMaks commented Feb 23, 2026

Enable wildcard domain and root path support

Summary

Remove WPR_DOMAIN_NAME parameter and add support for root virtual directory deployment.

Changes

Unrestricted domain access

  • Resolves Container always listens to a single domain #84
  • Remove WPR_DOMAIN_NAME, with a single default_server block, nginx server_name has no effect regardless of its value. The parameter provided no real access control and created a false sense of security.
  • Parameter removed from all Dockerfiles (Ubuntu, RedHat, prebuilt), perl scripts, startService.sh, and README
  • Verification URL now always displays placeholder

Previously: WPR_DOMAIN_NAME appeared to restrict domain access via server_name, but the default_server flag caused nginx to serve all requests regardless.

Now: The container accepts requests from any domain. The misleading parameter is removed.

Root virtual directory support

  • Resolves Container couldn't be run to listen to the root directory (/) #83
  • Support WPR_VIRTUAL_DIR=/ (or empty string) to run at root path
  • Fix slash normalization in configureWebServer.pl:
  • Strip leading/trailing slashes
  • Prevent double slashes in NGINX location directives
  • Handle root path: location / {, location /samples {, location /api {
  • Handle default path: location /wscservice {, location /wscservice/samples {, etc.
  • Update URL display in configureFiles.pl for root path compatibility
  • Update README to document root path option

Previously: Virtual directory always required subdirectory. Root path generated invalid NGINX configs with double slashes.

Now: Users can set WPR_VIRTUAL_DIR=/ to deploy at root path (default remains wscservice).

Breaking changes

BREAKING CHANGE: WPR_DOMAIN_NAME build argument and environment variable are removed.

Impact: Passing --env WPR_DOMAIN_NAME=... at runtime is silently ignored. Build args referencing it will produce a Docker warning.

Migration: Remove WPR_DOMAIN_NAME from your docker run commands, Dockerfiles, and compose files.

Default WPR_DOMAIN_NAME to '_' (wildcard) to accept requests from any domain.
Remove domain injection into sample files to enable wildcard configuration.

Previously, domain was always set to a specific value and couldn't be unrestricted. Samples now use relative paths instead of absolute URLs.

BREAKING CHANGE: WPR_DOMAIN_NAME defaults to '_' instead of 'localhost'
Add support for root virtual directory.

- Add support for WPR_VIRTUAL_DIR='/' to run at root path
- Fix slash normalization in configureWebServer.pl to prevent double slashes
- Update URL display in configureFiles.pl for root path compatibility
- Update README documentation for new configuration options

Previously, virtual directory always required a subdirectory. Root path configuration was not possible due to improper slash handling in NGINX location directives.
Copy link
Contributor

@solovyovk solovyovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing WPR_DOMAIN_NAME default to _ affects files/startService.sh. In the recently merged PR #85, we added self-signed certificate generation that uses WPR_DOMAIN_NAME
for the certificate CN:

-subj "/CN=${WPR_DOMAIN_NAME:-localhost}"

With _ as the new default, the cert would get CN=_ instead of CN=localhost. After this PR is merged, startService.sh needs to be updated to treat _ as localhost for cert
generation.

Dockerfile Outdated
ARG WPR_WEB_PORT
ARG WPR_DOMAIN_NAME=localhost
# Domain name for NGINX server_name directive. Default '_' accepts any domain. Set to specific domain to restrict access.
ARG WPR_DOMAIN_NAME=_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing WPR_DOMAIN_NAME default to _ affects files/startService.sh. In the recently merged PR #85, we added self-signed certificate generation that uses WPR_DOMAIN_NAME for the certificate CN:

-subj "/CN=${WPR_DOMAIN_NAME:-localhost}"

With _ as the new default, the cert would get CN=_ instead of CN=localhost.

We need update there code in files/startService.sh after the line 30 on something like that:

CERT_CN="${WPR_DOMAIN_NAME}"                                                                                                                                
[ -z "$CERT_CN" ] || [ "$CERT_CN" = "_" ] && CERT_CN="localhost"                                                                                            
echo "$(date '+%m/%d/%y:%H:%M:%S.%3N')   No SSL certificates found. Generating self-signed certificate for CN=${CERT_CN}..."
...
-subj "/CN=${CERT_CN}" 2>/dev/null

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@solovyovk solovyovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve

WPR_DOMAIN_NAME env var and build arg removed.

nginx server_name has no effect with a single default_server block —
the parameter provided no real access control. Remove it from all
Dockerfiles, perl scripts, startService.sh, and README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Container always listens to a single domain Container couldn't be run to listen to the root directory (/)

4 participants