Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Open
KharchenkoMaks wants to merge 3 commits intodevelopmentfrom
remove_domain
Open

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

Conversation

@KharchenkoMaks
Copy link
Contributor

Enable wildcard domain and root path support

Summary

Add support for wildcard domain configuration and root virtual directory deployment.

Changes

Wildcard domain support

  • Resolves Container always listens to a single domain #84
  • Default WPR_DOMAIN_NAME to _ (wildcard) to accept requests from any domain
  • Update all Dockerfiles (Ubuntu, RedHat, prebuilt)
  • Update configureFiles.pl to display <host> placeholder for wildcard
  • Update README with configuration guidance

Previously: Domain defaulted to localhost, requiring rebuild or runtime override to support multiple domains.

Now: Accepts requests from any domain by default. Set WPR_DOMAIN_NAME to restrict.

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 now defaults to _ (wildcard) instead of localhost.

Impact: Containers now accept requests from any domain by default.

Migration: If you require domain restriction, explicitly set WPR_DOMAIN_NAME

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.

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

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 (/)

3 participants