Describe the bug
If we run our web server on an alternate port, like 8080, let's say using wp server, then $_SERVER SERVER_NAME will not provide the correct WP_HOME calculation value, but $_SERVER HTTP_HOST does.
print_r( $_SERVER );
Array
(
...
[SERVER_NAME] => localhost
[SERVER_PORT] => 8080
[REQUEST_URI] => /
[HTTP_HOST] => localhost:8080
[SERVER_ADDR] => 127.0.0.1
[WP_ENV] => development
...
)
Alternatively, $_SERVER SERVER_PORT value maybe also has to be used in WP_HOME auto-calculation.
To Reproduce
- Run webserver on a non-standard port, like 8080
- Use
get_theme_file_uri() to calculate an enqueue asset URL
- Watch 404 errors for enqueued assets
Expected behavior
Port value recognized.