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

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)

Related

how to get dictionary value from webrequest using sharepoint designer

I am trying to retrieve a value from a HTTP web service call in sharepoint designer. This should be simple. the Rest query is simple, and always returns only a single value:
https://Site.sharepoint.com/sites/aSiteName/_api/web/lists/getByTitle('MyListTitle')/items/?$select=Title&$top=1
In the Sharepoint Designer workflow, I'm setting the required Accept and Content-type header to the value of "application/json;odata=verbose
I am unable to get the value of the "Title" field that is returned by the call.
when I execute the REST query in the browser, I get the following data returned:
{"d":{"results":[{"__metadata":{"id":"af9697fe-9340-4bb5-9c75-e43e1fe20d30","uri":"https://site.sharepoint.com/sites/aSiteName/_api/Web/Lists(guid'6228d484-4250-455c-904d-6b7096fee573')/Items(5)","etag":"\"1\"","type":"SP.Data.MyListName"},"Title":"John Doe"}]}}
I've tried dozens of variations of the dictionary 'query', but they always return blank.
I'm using the 'get an item from a dictionary' action in SP Designer, using item name or path values like:
d/results(0)/Title
d/Title
d/results/Title
and literally dozens of other variations - but it always returns blank.
I'm writing the raw response from the webRequest to the list for debugging, and it shows the value like this:
{"odata.metadata":"https:\/\/site.sharepoint.com\/sites\/aSiteName\/_api\/$metadata#SP.ListData.MyListTitle&$select=Title","value":[{"odata.type":"SP.Data.MyListTitle","odata.id":"616ed0ed-ef1d-405b-8ea5-2682d9662b0a","odata.etag":"\"1\"","odata.editLink":"Web\/Lists(guid'6228d484-4250-455c-904d-6b7096fee573')\/Items(5)","Title":"John Doe"}]}
I must be doing something simple that is wrong?
Using "d/results(0)/Title" is right. Check the steps in article below to create a workflow.
CALLING THE SHAREPOINT 2013 REST API FROM A SHAREPOINT DESIGNER WORKFLOW
It working fine in my test workflow.
I faced the exact same issue. In my case the reason was that in the API call, the header was not set properly.
As you would have noticed many times, that if you type the variables inline when creating the "Call Http Web service" action, those might not get set properly. The surest way is to open the properties and set from there. In my case when i opened the properties i found that RequestHeaders was not set. Once i set it from there, i got the desired results.
Hope this helps to someone in future, this question being unanswered till now!!
tried dump those json called from sharepoint workflow into a list. Sometimes you'll get a different format than when you called that from browser. I experienced this issue when calling API projectserver (project online). When I called it using servistate (chrome extension) it returns d/results, but when I dump the value into the list I got value and yet I used same request header value.

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.

In AEM/CQ5 , URL redirection using /etc/map not working

I have a use case to redirect /content/project/en/test/events to /content/project/en/test page as internal redirection of page properties is not working .
I used following values under /etc/map/http folder :
sling:match as (.+)/en/test/(.+)$
sling:internalRedirect as (.+)/en/test.html
Still my required redirection is not working .
Please let me know correct configuration for the same .
Thanks&Regards.
The sling:internalRedirect is the target to which user is taken so you should use in it the match from the sling:match
use: sling:internalRedirect as $1/en/test.html
btw. there's a useful article about mappings here: https://www.cognifide.com/our-blogs/cq/multidomain-cq-mappings-and-apache-configuration/
EDIT:
a simple config like this will work (redirect from home.html to page1.html):

Why does one HTTP GET request retrieve the required data and another retrieve []

I'm currently working on ng-admin.
I'm having a problem retrieving user data from my REST API (connected to a MongoDB) and displaying it.
I have identified the problem as the following:
When I enter http://localhost:3000/users into my browser, I get a list of all users in my database.
When I enter http://localhost:3000/users?_page=1&_perPage=30&_sortDir=DESC&_sortField=id,
I get [] as a result.
I am quite new to this, I used both my browser and the POSTMAN Chrome extension to test this and get the same result.
http://localhost:3000/users_end=30&_order=DESC&_sort=id&_start=0
This (/users_end) is a different request than /users.
It should be:
http://localhost:3000/users?end=30&_order=DESC&_sort=id&_start=0
Or, by looking at the other parameters:
http://localhost:3000/users?_end=30&_order=DESC&_sort=id&_start=0
with end or _end being the first parameter (mark the ?).
Update (it is ? and before the _, I have edited.):
If adding parameters to the request returns an empty list, try adding only one at a time to narrow down the problem (there's probably an error in the usage of those parameters - are you sure you need those underscores?).
Your REST API must have a way to handle pagination, sorting, and filtering. But ng-admin cannot determine exactly how, because REST is a style and not a standard. So ng-admin makes assumptions about how your API does that by default, that's why it adds these _end and _sort query parameters.
In order to transform these parameters into those that your API understands, you'll have to add an interceptor. This is all thoroughly explained in the ng-admin documentation: http://ng-admin-book.marmelab.com/doc/API-mapping.html

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