Subdomain wildcards experimentation

ImagesGuru

Core license
License owner
Joined
Nov 1, 2018
Messages
81
Points
58
ğŸŽ¯Description of the issue

I have a white page, using subdomain wildcards.

For exemple : https://es.images.guru

▶🚶‍Reproduction steps
  1. I have created a .es subdomain in my cpanel account
  2. I have activated ssl certificate for this .es subdomain
  3. I have edited the .htaccess file :
# Disable server signature
ServerSignature Off

<ifModule mod_headers.c>
Header set Access-Control-Allow-Origin: *
</ifModule>

# Enable CORS across all your subdomains (replace dev\.local with your domain\.com)
SetEnvIf Origin ^(https?://.+\.images\.guru(?::\d{1,5})?)$ CORS_ALLOW_ORIGIN=$1
Header append Access-Control-Allow-Origin %{CORS_ALLOW_ORIGIN}e env=CORS_ALLOW_ORIGIN

Header merge Vary "Origin"


😢Unexpected result

White page !

Thanks for help :)
 

ImagesGuru

Core license
License owner
Joined
Nov 1, 2018
Messages
81
Points
58
Got the logs :

G_ROOT_URL in /home/jmartinez/images.guru/app/loader.php on line 127
[11-Nov-2018 18:44:50 UTC] PHP Warning: constant(): Couldn't find constant G_ROOT_LIB_URL in /home/jmartinez/images.guru/app/loader.php on line 127
[11-Nov-2018 18:44:50 UTC] PHP Warning: constant(): Couldn't find constant G_APP_LIB_URL in /home/jmartinez/images.guru/app/loader.php on line 127
[11-Nov-2018 18:44:50 UTC] PHP Warning: Use of undefined constant CHV_APP_PATH_CONTENT_LANGUAGES - assumed 'CHV_APP_PATH_CONTENT_LANGUAGES' (this will throw an Error in a future version of PHP) in /home/jmartinez/images.guru/app/lib/classes/class.l10n.php on line 44
[11-Nov-2018 18:44:50 UTC] PHP Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(CHV_APP_PATH_CONTENT_LANGUAGES): failed to open dir: No such file or directory in /home/jmartinez/images.guru/app/lib/classes/class.l10n.php:44
Stack trace:
#0 /home/jmartinez/images.guru/app/lib/classes/class.l10n.php(44): DirectoryIterator->__construct('CHV_APP_PATH_CO...')
#1 /home/jmartinez/images.guru/app/lib/classes/class.l10n.php(259): CHV\L10n::bindEnabled()
#2 /home/jmartinez/images.guru/app/lib/functions.php(372): CHV\L10n::getEnabledLanguages()
#3 /home/jmartinez/images.guru/app/loader.php(129): CHV\get_enabled_languages()
#4 /home/jmartinez/images.guru/index.php(20): include_once('/home/jmartinez...')
#5 {main}

thrown in /home/jmartinez/images.guru/app/lib/classes/class.l10n.php on line 44

Thanks for help.
 

JakeSully

Network license
Beta tester
Joined
Feb 23, 2014
Messages
269
Points
78
i see your problem. When i removed # infront of cors lines it also gave me 500 internal server error. Do not remove # infron't keep it as it is and it will work.

it should look like this

Code:
# Disable server signature
ServerSignature Off

<ifModule mod_headers.c>
Header set Access-Control-Allow-Origin: *
</ifModule>

# Enable CORS across all your subdomains (replace dev\.local with your domain\.com)
# SetEnvIf Origin ^(https?://.+\.images\.guru(?::\d{1,5})?)$ CORS_ALLOW_ORIGIN=$1
# Header append Access-Control-Allow-Origin %{CORS_ALLOW_ORIGIN}e env=CORS_ALLOW_ORIGIN
# Header merge Vary "Origin"
And not this

Code:
# Disable server signature
ServerSignature Off

<ifModule mod_headers.c>
Header set Access-Control-Allow-Origin: *
</ifModule>

# Enable CORS across all your subdomains (replace dev\.local with your domain\.com)
SetEnvIf Origin ^(https?://.+\.images\.guru(?::\d{1,5})?)$ CORS_ALLOW_ORIGIN=$1
Header append Access-Control-Allow-Origin %{CORS_ALLOW_ORIGIN}e env=CORS_ALLOW_ORIGIN
Header merge Vary "Origin"
 

ImagesGuru

Core license
License owner
Joined
Nov 1, 2018
Messages
81
Points
58
o2switch, a French leader in hosting.

How do you have set the subdomain wildcard ?

Logs for me :
[11-Nov-2018 19:03:22 UTC] PHP Warning: constant(): Couldn't find constant G_ROOT_URL in /home/jmartinez/images.guru/app/loader.php on line 127
[11-Nov-2018 19:03:22 UTC] PHP Warning: constant(): Couldn't find constant G_ROOT_LIB_URL in /home/jmartinez/images.guru/app/loader.php on line 127
[11-Nov-2018 19:03:22 UTC] PHP Warning: constant(): Couldn't find constant G_APP_LIB_URL in /home/jmartinez/images.guru/app/loader.php on line 127
[11-Nov-2018 19:03:22 UTC] PHP Warning: Use of undefined constant CHV_APP_PATH_CONTENT_LANGUAGES - assumed 'CHV_APP_PATH_CONTENT_LANGUAGES' (this will throw an Error in a future version of PHP) in /home/jmartinez/images.guru/app/lib/classes/class.l10n.php on line 44
[11-Nov-2018 19:03:22 UTC] PHP Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(CHV_APP_PATH_CONTENT_LANGUAGES): failed to open dir: No such file or directory in /home/jmartinez/images.guru/app/lib/classes/class.l10n.php:44
Stack trace:
#0 /home/jmartinez/images.guru/app/lib/classes/class.l10n.php(44): DirectoryIterator->__construct('CHV_APP_PATH_CO...')
#1 /home/jmartinez/images.guru/app/lib/classes/class.l10n.php(259): CHV\L10n::bindEnabled()
#2 /home/jmartinez/images.guru/app/lib/functions.php(372): CHV\L10n::getEnabledLanguages()
#3 /home/jmartinez/images.guru/app/loader.php(129): CHV\get_enabled_languages()
#4 /home/jmartinez/images.guru/index.php(20): include_once('/home/jmartinez...')
#5 {main}

thrown in /home/jmartinez/images.guru/app/lib/classes/class.l10n.php on line 44
 

JakeSully

Network license
Beta tester
Joined
Feb 23, 2014
Messages
269
Points
78
you gota add a CNAME not A record, so it should be *.images.guru as CNAME
 

tomsit

Moderator & Chevereto freak
Community Staff
Joined
Nov 25, 2016
Messages
495
Points
145
Location
Norway
Website
freeimage.host

JakeSully

Network license
Beta tester
Joined
Feb 23, 2014
Messages
269
Points
78
@tomsit Yes Lets Encrymt now génèrate wildcard SSL certificate.
@JakeSully Have you created the cname record in cpanel or directly through your registrar ?
When you point the domain to a nameserver then it must be created in cPanel and not domain registrar because DNS records at domain registrar is only valid if you point the domain to their name servers.
 

ImagesGuru

Core license
License owner
Joined
Nov 1, 2018
Messages
81
Points
58
Yes I know :)
But you, what are you using ?

I have created subdomain in cpanel "*.images.guru" that point to "images.guru", then I have modified dns A entry to cname.
 

ImagesGuru

Core license
License owner
Joined
Nov 1, 2018
Messages
81
Points
58
@Rodolfo some idea ? Not working with cname or A record.

My log :
[12-Nov-2018 16:25:31 UTC] PHP Warning: constant(): Couldn't find constant G_ROOT_URL in /home/jmartinez/images.guru/app/loader.php on line 127
[12-Nov-2018 16:25:31 UTC] PHP Warning: constant(): Couldn't find constant G_ROOT_LIB_URL in /home/jmartinez/images.guru/app/loader.php on line 127
[12-Nov-2018 16:25:31 UTC] PHP Warning: constant(): Couldn't find constant G_APP_LIB_URL in /home/jmartinez/images.guru/app/loader.php on line 127
[12-Nov-2018 16:25:31 UTC] PHP Warning: Use of undefined constant CHV_APP_PATH_CONTENT_LANGUAGES - assumed 'CHV_APP_PATH_CONTENT_LANGUAGES' (this will throw an Error in a future version of PHP) in /home/jmartinez/images.guru/app/lib/classes/class.l10n.php on line 44
[12-Nov-2018 16:25:31 UTC] PHP Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(CHV_APP_PATH_CONTENT_LANGUAGES): failed to open dir: No such file or directory in /home/jmartinez/images.guru/app/lib/classes/class.l10n.php:44
Stack trace:
#0 /home/jmartinez/images.guru/app/lib/classes/class.l10n.php(44): DirectoryIterator->__construct('CHV_APP_PATH_CO...')
#1 /home/jmartinez/images.guru/app/lib/classes/class.l10n.php(259): CHV\L10n::bindEnabled()
#2 /home/jmartinez/images.guru/app/lib/functions.php(372): CHV\L10n::getEnabledLanguages()
#3 /home/jmartinez/images.guru/app/loader.php(129): CHV\get_enabled_languages()
#4 /home/jmartinez/images.guru/index.php(20): include_once('/home/jmartinez...')
#5 {main}
thrown in /home/jmartinez/images.guru/app/lib/classes/class.l10n.php on line 44


My host said that this error is a programming error :
[12-Nov-2018 16:25:31 UTC] PHP Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(CHV_APP_PATH_CONTENT_LANGUAGES): failed to open dir: No such file or directory in /home/jmartinez/images.guru/app/lib/classes/class.l10n.php:44
 

Attachments

JakeSully

Network license
Beta tester
Joined
Feb 23, 2014
Messages
269
Points
78
No you aren't supposto create a subdomain. Remove it and then go into DNS editor and only add a CNAME record. This explains why your wildcards aren't working.