How to set Typo3 v10 site config for the equivalent of wildcards but with one exception? - configuration

How can I set the Typo3 V10 Site Configuration to do this:
Everything incoming go to one site root page:
Except this one subdomain, which goes to a separate root page:
I have a web app based on Typo3 8.7 that I'm trying to upgrade to v10. In the 8.7 app, each customer organisation has a unique subdomain - school1.webapp.com, anotherschool.webapp.com etc., all pointing to the same typo3 site root page. Each time I need to create a new customer, all I have to do is to add a new sys_domain record and a custom plugin picks up the current sys_domain record as the means to separate customer data. A wildcard sys_domain record of *.webapp.com the picks up any misspellings and redirects to a separate page.
The one exception is auth.webapp.com which handles oauth authentication for all customers and goes to a different site root page.
This allows me to add new customers with just a simple form, which adds a new sys_domain record and job finished.
I now need to upgrade to Typo3 v10. I can detect the incoming subdomain to split between customer data easily enough, but I'm having problems with the new Site Configuration tool. All I need is to route auth.webapp.com to one site root page and everything else incoming to another.
My current setup seems to work for getting everything to route to the site root
- Entry point /
- Variant Base: https://%env(HTTP_HOST)%/
Condition: getenv("HTTP_HOST") == "*"
But if I create a second site entry for the auth.webapp.com domain, I just get an FE error of
"Page Not Found - The page did not exist or was inaccessible. Reason: The requested page does not exist"
Entry point https://auth.webapp.com
An entry point of /auth.webapp.com/ results in this subdomain going to the main customers entry point, even though the yaml entry says its pointed to the correct start point.
MAIN SITE - All incoming subdomains except auth.webapp.com
base: /
baseVariants:
-
base: 'https://%env(HTTP_HOST)%/'
condition: 'getenv("HTTP_HOST") == "*"'
errorHandling:
-
errorCode: 404
errorHandler: Page
errorContentSource: 't3://page?uid=13'
-
errorCode: 403
errorHandler: Page
errorContentSource: 't3://page?uid=1'
-
errorCode: 500
errorHandler: Page
errorContentSource: 't3://page?uid=14'
flux_content_types: ''
flux_page_templates: ''
languages:
-
title: English
enabled: true
base: /
typo3Language: default
locale: en_GB.UTF-8
iso-639-1: en
websiteTitle: 'Website Title Name'
navigationTitle: ''
hreflang: en-GB
direction: ''
flag: gb
languageId: 0
rootPageId: 1
websiteTitle: 'Website Title Name'
AUTHENTICATION SITE - just auth.webapp.com
base: 'https://auth.webapp.com/'
flux_content_types: ''
flux_page_templates: ''
languages:
-
title: English
enabled: true
base: /
typo3Language: default
locale: en_GB.UTF-8
iso-639-1: en
websiteTitle: ''
navigationTitle: ''
hreflang: ''
direction: ''
flag: gb-eng
languageId: 0
rootPageId: 11
websiteTitle: 'Website Title'

You should make use of environment variables provided by your webserver in this case.
Setting i.e. AUTHENTICATED as an indicator for anything else than auth.webapp.com would help to filter the base variants for the common configuration condition and make sure that auth.webapp.com would be skipped there.

Jo's answer did the job. I'm posting a little more here to help others.
==============
.htaccess file
==============
<If "%{HTTP_HOST} != 'unique\.domain\.com'">
SetEnv SPECIALNAME_ALLOW allow
</If>
<If "%{HTTP_HOST} == 'unique\.domain\.com'">
SetEnv SPECIALNAME_ALLOW skip
</If>
==============
Typo3 SITE entry for the unique domain
==============
Entry Point - https://unique.domain.com/
Variant Base - https://unique.domain.com/
Variant Condition - getenv("SPECIALNAME_ALLOW ") == "skip"
==============
Typo3 SITE entry for everything else
==============
Entry Point - /
Variant Base - /
Variant Condition - getenv("SPECIALNAME_ALLOW ") == "allow"

Related

Jmeter loop though CSV Data set config - Ajax flow

I am new to Jmeter and trying to carry out the following flows:
User Login with username and password
Page 1 is displayed with 10 invoices - User select ten invoices -
10 ajax call is executed (invoice1, invoice2,invoice3.. json file is generated with invoices as request)
Page 2 is displayed to view invoices
User log out
I have recorded the flow with blazemeter plugin on chrome.
The thread group in Jmeter has the following tasks:
I have 10 users in a file called users.txt and i am using CSV Data
set config to load them.
For each user I will load only 10 invoices from invoices.txt using
CSV Data set config to load them.
Since I have 10 users and each user needs 10 invoices, my
invoices.txt has 100 unique invoices.
Please find csv config for invoice below:
The problem is that I need each user to be assigned with 10 unique invoices and those 10 invoices cannot be allocated to another user.
Any idea how I can load 10 unique invoices for each user and make sure those invoices are not assigned again to another user?
invoices.txt should have only unique IDs before test start, you can share the IDs using:
CSV Data Set Config inside loop of users with attributes:
Sharing mode - All Threads - ID won't be repeated
Recycle on EOF? - False - for not to get invalid Id (<EOF>)
Stop thread on EOF? - True - Stop when file with unique IDs ends
You can consider using HTTP Simple Table Server instead of 2nd CSV Data Set Config.
HTTP Simple Table Server has KEEP option, given you set it to FALSE each used "invoice" will be removed, it will guarantee uniqueness even in case when you run your test in Distributed (Remote) mode
You can install HTTP Simple Table Server (as well as any other JMeter Plugin) using JMeter Plugins Manager

No Role found with id: 106 (HTTP 404) in Keyrock when creating new application

I have a problem when creating new application in Horizon(Identity manager GE).
Im logged in as idm user and when creating application, on the first step when i specify name, description, callback and url and press next i get following error:
Error: No Role found with id: 106 (HTTP 404)
Error: Unable to register the application.
What might be the problem?
The mistake was in the Horizons local_settings.py file.
instead of attributes FIWARE_PURCHASER_ROLE_ID and FIWARE_PROVIDER_ROLE_ID pointing to corresponding row ids of table role_fiware like this:
FIWARE_PURCHASER_ROLE_ID = '5786623590bc4f3ab01c61733a13ee6d'
FIWARE_PROVIDER_ROLE_ID = '4806909eb4b646c7a1f11ad9f9ed53ed'
attributes were :
FIWARE_PURCHASER_ROLE_ID = '106'
FIWARE_PROVIDER_ROLE_ID = '191'
I guess that is default configuration for sqlite db.
So if using mysql db just insert correct ids in this file for these attributes from table role_fiware.

'Home' category page not working after update

A prestashop website at version 1.4.1.4 was working with category.php file for category pages. The update to 1.6.0.6 unfortunatley deleted that file because it has been considered as deprecated. (URL structure changed after CMS update)
One consequence is the change in the URL structure.
from:
url/category.php?id_category=6
to :
url/index.php?id_category=6&controller=category&id_lang=2
So now, the first URL structure is giving 404.
The question:
We don't know why all the category pages are working fine with the new strucure, except the page for Home(acceuil) category (the global parent category for all website categories). This home category page is giving 404 even with the new structure. In other words, the following url is not working:
url/index.php?id_category=1&controller=category&id_lang=2
If I am not wrong, Prestashop gives id=1 by default to this home category? What is going wrong in your point of you? Any insights are highly appreciated.
Edit based on Prestashop-Developper.co answer
When I checked my database in PhpMyAdmin:
After update from 1.4.1.4 to 1.6.0.6:
I found neither a category with id=0 nor a category with id=2. I only find the category Home with id=1 and category Root with id=104. Root is parent of Home, but the field is_root_category for Home is set to 1!!!! I am really not understanding anything.
Before update from 1.4.1.4 to 1.6.0.6:
There is no Root category at all, and there is no is_root_category field at all.
Note:
These observations are based on the tables : ps_category, ps_category_group, ps_category_product, ps_category_shop before and after updtate =between 1.4.1.4 to 1.6.0.6.
In PrestaShop 1.6 the Root & Home categories always return 404 (in PS 1.5 only Root returns 404), if you need to change that for Home category you must create an override for CategoryController.
Note that in PrestaShop 1.4 you have "Home" with id=1 and since 1.5 you have "Root" with id=1 and "Home" with id=2. Find the ID of the Home category.
Create file CategoryController.php in /override/controllers/front/ with the following content:
<?php
class CategoryController extends CategoryControllerCore
{
public function canonicalRedirection($canonicalURL = '')
{
if (Tools::getValue('live_edit'))
return ;
if (!Validate::isLoadedObject($this->category) || !$this->category->inShop() || !$this->category->isAssociatedToShop() || $this->category->id == Configuration::get('PS_ROOT_CATEGORY'))
{
$this->redirect_after = '404';
$this->redirect();
}
if (!Tools::getValue('noredirect') && Validate::isLoadedObject($this->category))
FrontController::canonicalRedirection($this->context->link->getCategoryLink($this->category));
}
}
Make sure you delete /cache/class_index.php after creating the above file.

Need help dealing with subdomains and regions

Well, i'm about creating a new set of subdomains, by countries [germany, poland..] something like
germany.example.com
the thing is , i have a database with set of data containing a country field:
Item1 -- PL
item2 -- PL
item3 -- XX
item4 -- XX
i want that subdomain to pull the data from this specific country only, so poland.example.com will only filter data from that country.
i have my script working from the main domain example.com with a dropdown box where you can select the country and it adds cookies or /preferences to the user.
the main question is : how can i deal with the subdomain the right way?
When a browser sends a request to a server, it includes a Host: header which tells the server which subdomain the user wants. Use this in your script to select the correct database.
Done!
Solution
From the hosting : create a subdomain with root directory so subdomain XX.example.com should not have a folder /xx in your root directory, its directory must remain null
get the subdomain using php (explode $_SERVER Host if you want... or any other method you prefer)
process the subdomain variable from your main web script, since now you have the subdomain value (XX) you can process it using your script.
... do whatever you want with that subdomain value, like
if ( $subdomain == "xx" ) ... do something here
else .. do something else

Embedding Recent Changes on Main Page on MediaWiki

I am a complete and total newbie with MediaWiki. I would like to find a way to include Recent Changes directly on the Main Page, without having to have the user navigate to the recent changes page. What are my options for this?
Thanks!
One way would be to put
{{Special:RecentChanges}}
in [[Main_Page]].
The News extension (available at http://www.mediawiki.org/wiki/Extension:News ) is a way to do this very simply, and can be customized so that the entire recent changes page is not displayed. Just install the extension and then adding the
<news/>
tag will include the 10 most recent changes. Parameters to change the number of items shown, exclude minor changes, or format how they are displayed are available on the website linked above.
There is also an extension : Dynamic Article List - which allows you more control over what to display in your list of recent changes.
http://meta.wikimedia.org/wiki/User:Socoljam/DynamicArticleList_%28enhanced%29
This is an enhanced version of a MediaWiki extension of the same name. It also provides slightly clearer instructions to install it and get it working.
I wanted the same thing, but in a much simpler list than the full output of {{Special:RecentChanges}}. The following database query gives just the page names of the changes in the last 30 days, without the recently deleted pages:
SELECT DISTINCT rc_title
FROM recentchanges
WHERE rc_timestamp > (CURRENT_DATE - INTERVAL '30 days')
AND rc_new_len > 0
ORDER BY rc_title
(This is with PostgreSQL. It might be slightly different with MySQL)
To put that on the Main page, I used the ExternalData extension with it's #get_db_data function.
In LocalSettings.php:
wfLoadExtension( 'ExternalData' );
$wgExternalDataSources['mydb'] = [
'server' => '127.0.0.1', // or 'yourwiki.example.com',
'type' => 'postgres', // mysql, postgres, sqlite, ...
'name' => 'wikidb', // wiki DB name
'user' => 'backup_bot', // user with only "SELECT" rights
'password' => ''
];
Then, in the Main_page:
{{#get_db_data:
db=mydb
|from=recentchanges
|where=rc_timestamp > (CURRENT_DATE - INTERVAL '30 days') AND rc_new_len > 0
|order by=rc_title
|group by=rc_title
|data= title=rc_title
|suppress error
}}
Changes in the last 30 days:
{| class="wikitable"
! title
{{#for_external_table:<nowiki/>
{{!}}-
{{!}} {{{title}}}
}}
|}
Or as a simple list:
{{#for_external_table:
* [[{{{title}}}]]
}}