Monadwidget in Frontend type - reflex

Some of the examples use monadwidget, with mainwidget. While obelisk generated project expects you to use a frontend data type. I couldn't find a reference to this type in the guide, but how would you use monadwidget within the type?

You're supposed to use prerener or prerender_:
prerender_ blank $ bodyElement
Youll have to disable cors too: Disable same origin policy in Chrome
Source: https://github.com/obsidiansystems/obelisk/issues/320

Related

TYPO3 6.2 / RealURL : 404 error with google tag in URL

On this website :
https://lessentiel.novethic.fr/blog/business-case-3/post/orpea-dialogue-de-sourds-face-a-lengagement-actionnarial-des-acteurs-de-la-finance-durable-810#scrollTop=0
Google Analytics add parameters for cross-domain-tracking to url so a working link like this one
https://www.novethic.fr/actualite/gouvernance-dentreprise/entreprises-controversees/isr-rse/les-sombres-dessous-d-orpea-ont-echappe-aux-filets-de-la-notation-rse-150534.html
become this, that lead to 404 error
https://www.novethic.fr/actualite/gouvernance-dentreprise/entreprises-controversees/isr-rse/les-sombres-dessous-d-orpea-ont-echappe-aux-filets-de-la-notation-rse-150534.html?_gl=1*1rw78bk*_ga*ODIzMDE2MTIuMTYzODE5MjUyMw..*_ga_FVLX79JNXC*MTY0NDQ4NjM1OC40OC4xLjE2NDQ0ODg2MDkuMA..#_ga=2.179165860.1898940241.1644433835-82301612.1638192523
Any tell TYPO3/ RealURL to ignore cross-domain-tracking parameters ?
_gl=11rw78bk_gaODIzMDE2MTIuMTYzODE5MjUyMw.._ga_FVLX79JNXC*MTY0NDQ4NjM1OC40OC4xLjE2NDQ0ODg2MDkuMA..#_ga=2.179165860.1898940241.1644433835-82301612.1638192523
Take a look into configuration what is set for the settings:
$GLOBALS['TYPO3_CONF_VARS']['FE']['cHashExcludedParameters']
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFoundOnCHashError']
In pageNotFoundOnCHashError you can define if the system throws a 404 when cHash parameters are not valid e.g. when a parameter was added but not handled in cHash. This is happening when an external service adds parameter like Google does in your case.
In cHashExcludedParameters you can define the parameters that are not used to validate the cHash.
There are 2 options now:
Set pageNotFoundOnCHashError to 0 (not so good solution as there won't be a 404 when someone tries to manipulate the parameters)
Add _gl to the list of cHashExcludedParameters (better solution as you whitelist the Google parameter and keep your system safe)

AEM Internal Redirect

I'm trying to do an internal redirect in AEM 6.3, what I'm trying to do is: any request coming to localhost:4502/aem should be redirected to localhost:4502/content/myapp/en/login.html. So I created a sling:mapping node under /etc/map/http/:
jcr:primaryType="sling:Mapping"
sling:internalRedirect=/content/myapp/en/login.html -> Type String
sling:match=localhost.4502/aem -> Type String
I'm getting an Internal Server Error: Cannot serve request to /aem on this server. But if I add the .html suffix (request to localhost:4502/aem.html it works and redirects correctly.
Also tried:
sling:match=localhost.4502/aem(.*)(/.*)?
I wonder what I'm missing/doing wrong. Thanks in advance for your help.
I solve it using sling:redirect instead of sling:internalRedirect, not sure if this is the proper solution, but is working:
jcr:primaryType="sling:Mapping"
sling:redirect=localhost:4502/content/myapp/en/login.html -> Type String
sling:match=localhost.4502/aem -> Type String
If you have a better option, feel free posting it, Thanks.
I would recommend you go to http://localhost:4502/system/console/jcrresolver to check whether your redirects are correct or incorrect!
for example your
CRXDE Internal URL is http://localhost:4502/content/app1/en-in/home.html
and preferred external URL is http://localhost:4502/home/
There are to options you will be able to see
map:
map returns you the external URL when you enter internal URL. Remember to add .html at the end.
resolve:
resolve does the reverse of map. Remember to add .html at the end while testing.

Apache Sling Resource Mapping in CQ 5.6.1

I've been taking several hours fiddling this Resource Mapping for no luck. I have put a new node in /etc/map/http named GoogleAnalyticsMap. It had the following properties:
Name: jcr:primaryType
Type: Name
Value: sling:Mapping
Name: sling:internalRedirect
Type: String
Value: /content/dam/website/Common/my_google_analytics_key.html
Name: sling:match
Type: String
Value: [^/]+/[^/]+/my_google_analytics_key.html
Funnily, when i checked to /system/console/jcrresolver or Adobe CQ Web Console Sling Resource Resolver. It resolves into the following
Pattern: ^http/[^/]+/[^/]+/my_google_analytics_key.html
Replacement: /content/dam/website/Common/my_google_analytics_key.html
Redirect: internal
I have no idea how they could register ^[^/]+/[^/]+/welcome$ as shown in the example and did not have the 'http' there. Nevertheless, whenever i try to hit the pattern locally (i.e. http://localhost:4502/my_google_analytics_key.html) it only shows resource not found. Also checked through the Configuration test section that available in Adobe CQ Web Console Sling Resource Resolver it says that it can't resolve. Did i miss something?
, type=sling:nonexisting, path=/my_google_analytics_key.html, resource=[NonExistingResource, path=/my_google_analytics_key.html]
Thank you for the help.
p.s. i've checked the Sling documentation also, however, it baffles me that i can't add sling:alias, perhaps its also something to do with the sling version. Nevertheless, i should ask this as second question later, once the sling:match is working properly.
Edit: fiddling a bit, changing the sling:match to localhost.4502/google.html does let it to redirect localhost:4502/google.html to the desired DAM item. Well, i'm still asking for 'domain-free' matching though.. so i have no trouble when using the mapping for all environment i have..
Edit, Updates:
Apparently due to me put the new sling:Mapping under http folder it will always prefix the path with http. Perhaps the example is meant to be put not under http folder.
Next item is, it will always assume the matching item will be protocols, domain, and port separated by dots (yes, even \. is not a valid input and CQ or rather sling will sanitize it somehow). Something like *.(4502|4503|80|443)/my_google_analytics_key.html will accept any domains and those designated ports. I do wonder if it really the case, since they says regex but it does not feel so much regex.
Some says that sling:internalRedirect should be a String[] - yes i know the docs says String. I have not test this further and take it as it is..

How to set up API gateway without specifying all resources

I have some EC 2 applications (in node.js) that have many REST paths, and since still in development process, the path keep changing.
How can I set up in the api-gateway, that will map to multiple paths, instead of specify each of them?
e.g.
my ec2 end points have:
my.ec2.com/api/test
my.ec2.com/api/test1
my.ec2.com/api/test2
my.ec2.com/api/user/time
my.ec2.com/api/user/time1
my.ec2.com/api/user/time2
instead of setting the all resources in api-gateway,
can I do something like:
api-gateway.amazon.com/api that points to my.ec2.com/api/
and it will resolve any call to http://api-gateway.amazon.com/api/test automatically points to http://my.ec2.com/api/test, etc. ?
As of today, it is still impossible in the API gateway console.
The solution is to use Swagger. then I can use some scripts to generate the Swagger file and import to API gateway. In fact, it is a good solution because I can source control on Swagger.

Decode RealUrl url in the controller

I use RealUrl for my website. In my certain extension, I require to decode the url created by RealUrl to the normal TYPO3 url format.
Example:
To my controller I get this link : typo3website/feature/number/123 , now how do I convert this to typo3website/index.php?id=99&number=123
The RealUrl does not use namespace, and hence i'm unable to understand how to create an instance of the class tx_realurl.
I tried using require_once(PATH_typo3conf.'ext/realurl'.'/class.tx_realurl.php'); and creating new instance of tx_realurl, but gives a class not found error.
If RealURL is configured properly and the link is generated with the uriBuilder or the ActionViewHelper, you don't need to take care of that. If we take your example and you configured RealURL to use typo3website/feature/number/123 for index.php?id=99&tx_yourext[number]=123, you can use this as argument for your action:
public function showAction($number) {
}
You can also access all arguments from a controller action by using
$this->request->getArguments()