Fallback to default TYPO3 page type if invalid type number/typeNum is requested - typo3

In my TYPO3 9 LTS installation, when a request with an invalid (i.e. no TypoScript-configured) type number (PAGE.typeNum) comes in, my installation returns an ugly error message:
Example request: https://www.example.com?type=1234
Example response:
Service Unavailable (503)
The page is not configured! [type=1234][]. This means that there is no TypoScript object of type PAGE with typeNum=1234 configured.
More information regarding this error might be available online.
The more information link points to https://typo3.org/go/exception/CMS/1294587217 , but there currently isn't any helpful information how to better configure my installation.
These error messages are also annoying as they may be triggered by webcrawlers and each request creates an error entry in the TYPO system protocol.
What can I do to fallback to/serve the default type=0 HTML page if a requested type number is not configured?

AFAIK TYPO3 can currently not properly handle that. A 503 is generated, but the according errorHandler in the site configuration is not triggered.
At least the error message will be a bit less ugly ("Ooops, an error...") when you are in TYPO3_CONTEXT=Production ...
There is a feature request to make the unknown page type behave like 404: https://forge.typo3.org/issues/86844
For the time being I suggest adding redirects (301) for all types that you do not want to serve outside of TYPO3 (e.g. .htaccess RewriteRules or nginx rewrites).

Related

Why AEM returns 403 for requests without extensions?

By default all the GET requests go to DefaultGetServlet first. Based on the extension, it delegates the request to renderers. Now, if there is no extension in the request URI, why AEM sends 403 (Forbidden) ? At the most, if AEM is unable to serve this, it may send a BAD REQUEST instead. AEM sends 403 even if you are logged in as an admin user (Which has highest level of authorization, if that helps).
Example:
http://localhost:4502/content/geometrixx/en/events
this URL will be responded with 403. Whereas
http://localhost:4502/content/geometrixx/en/events.html
will be served without any problems.
Adding to the above, as mentioned by Ahmed:
With the URL "http://localhost:4502/content/geometrixx/en/events" StreamRendererServlet will get executed and resolves to redirect logic ending with /.
// redirect to this with trailing slash to render the index
String url = request.getResourceResolver().map(request,resource.getPath())+ "/";
response.sendRedirect(url);
Once redirected to "http://localhost:4502/content/geometrixx/en/events/"
The same StreamRendererServlet resolves to directory listing logic.
// trailing slash on url means directory listing
if ("/".equals(request.getRequestPathInfo().getSuffix())) {
renderDirectory(request, response, included);
return;
}
In the renderDirectory as indexing will be false,
if (index) {
renderIndex(resource, response);
} else {
response.sendError(HttpServletResponse.SC_FORBIDDEN);
}
a 403 Forbidden response will be sent.
You can change this behavior by enabling "Auto Index" for "Apache Sling GET Servlet" felix configuration console.
As of this sling ticket SLING-1231 closed in 2009, if no renderer is found the return status code should be 404.
you can see that in the sling sourcecode for DefaultGetServlet.java in the doGet method. source
The following tested on AEM 6.3 but should be the same for 6.0+
For example, if you tried to visit http://localhost:4502/content/geometrixx/en/events.something you'd get a 404 and the sling progress tracker would log No renderer for extension something
Now, if I may rephrase your question, why does extension=null return a 403?
If you look at the sling progress tracker response, you'll probably notice this log:
Using org.apache.sling.servlets.get.impl.helpers.StreamRendererServlet to render for extension=null
Which means that for a null extension, Sling will use the StreamRendererServlet(source) to try and render the resource. Somewhere in that code or probably a filter applied after causes the 403 response code you see. You'll have to debug that one yourself and find out where exactly a 403 is returned.
Adding on to what Ahmed said:
Without extension, Sling assumes that you are trying to list the contents of that directory path and looks for an index file under that path. When it doesn't finds that index file, it throws back the forbidden error.
If you add an index file under the events node and try to request the same extensionless url, it will serve that index file.
That is to say, when you add the index file (index.html) under /content/geometrixx/en/events,
all requests to http://localhost:4502/content/geometrixx/en/events or http://localhost:4502/content/geometrixx/en/events/index.html will return the same result.

getting redirect uri mismatch error in google plus despite having no uri mismatch

Please consider the following two websites that I am pinging as shown in the image below:
I have a google plus login icon where a user can click on it and can sign in using his/her google account.
My website where all the login code is residing is say for example xyztesting.com as shown in the image. And all the code related to xyztesting.com resides on the box 10.11.10.12 which has a domain name abctesting.com.
So, when i ping abctesting.com, I get Packets Sent and Received = 4 as shown in the image.
However, when I ping xyztesting.com , I get Request timed out as shown in the image below.
Does anyone knows whether this could be the reason behind why I am getting Redirect URI Mismatch error 400 error whenever a user tries to log in using google plus ?
I have ensured that the REDIRECt URI in the request matches the Registered Redirect URIs which is the most common message displayed when some one encounters this error and this is the most common fix suggested online everywhere.
I have referred to lot of previous related posts, including this one where they talks about making sure that the request URI's should match the registered URI on google developer console.
I have got a feeling that since there is not a dedicated box/server for my website xyztesting.com, google is thowing such error. Please let me know if anyone has experienced such type of error with the situation I have described above?
Sometimes, the redirect uri should be set to "postmessage" not the actual uri.
The documentation is not so clear on that setting.
-Dragonfire

IIS.7 Error on url rewrite done with http Module

I have a ASP.NET web application that implements url rewrite throught an Http Module. Each rewrite rule are loaded from a database table.
After I added a new rule I got the following error:
Value does not fall within the expected range.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Value does not fall within the expected range.
I don't find anyting in application logs.
In this case, after a long investigation I found the character
\n
after redirection url name.
When http module send redirect to IIS, all went Ok, but during request processing IIS itself got the error above.
I think that's a very strange error, and I spent lot of time to detect, so I think to share solution (of course it's all my fault!).

An appropriate representation of the requested resource /page.php could not be found on this server

In a page in my website I have a link as below:
Go to the page.php
When I click the link, I get the following error:
406 Not Acceptable
An appropriate representation of the requested resource /page.php could not be found on this server.
This is the header information which I captured via Live HTTP headers:
EDIT:
That's really weird, because when I convert the parameter value from selectquiz to:
selectq
selectqu
...
selectquiz
it's not working, but when when I type selec it is OK!! (In all browsers)
I'm getting the same error message, but it seems to be a generic problem with mine when i try to add images to posts/pages etc, i can upload images but they just won't. I've tried re-uploading the images, installed a fresh wordpress download, tried different themes, no change.

Tab Page Error: The requested method GET is not allowed

I have just set up a custom tab on my page for the first time. I have thoroughly followed the setup guide and seem to have everything on the Facebook side setup correctly.
However when I view my page it throws the following error:
Method Not Allowed The requested method GET is not allowed for the
URL /Facebook/index.html. Additionally, a 404 Not Found error was
encountered while trying to use an ErrorDocument to handle the
request. Apache/1.3.41 Server at feebnaturals.com.au Port 80
I believe it may be some kind of Apache server config issue, however I'm not that Apache savvy, so not sure where to start.
I had the same problem, but instead of GET, it was POST method which was not allowed. This is a setting on your server. Not server savvy myself, but it seems that my provider didn't allow this method on html-page, but makes no problem on doing the same for php-pages. So all I did was rename my page from .html to .php, updated the app settings in facebook and all works fine now.
This is definitely an error on your side, check your server logs and see what they say - it looks like you've configured the page to only work via a POST request and it's being requested in a GET request