I have such problem: If page on my sites doesn't exists it always does redirect at main page, but I want to display 404 error.
Example: example.com/sdasadsasad - I see main page. How I can fix it? I tried add in localconfiguration
'pageNotFound_handling' = '/';
'pageNotFound_handling_statheader' = 'HTTP/1.1 404 Not Found';
but it doesn't help.
TYPO3 7.6.11
Look in the description of the install tool for the settings. There is described what setting doing what.
So an String in pageNotFound_handling will fetch the page entered and display this, true or 1 will display an error message.
I recommand to create an error page like example.com/404.html within TYPO3 and enter 404.html in pageNotFound_handling so you can customize the error.
If you want only to shown an error enter trueor 1 in the pageNotFound_handling setting.
We were experiencing the same problem. We have curl enabled ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse'] = 1). Due to our configuration, curl was not able to fetch the error page because the SSL certificate could not be verified.
Be careful, the following idea is ugly:
You might find out more about the problem by editing TypoScriptFrontendController.php: Find the function pageErrorHandler (about line 2000 -- who writes such long files?!), find the call to GernalUtility::getUrl() and add as fourth parameter a new array variable. var_dump it instead of the call to HttpUtility::redirect. You should get the curl error if there is one.
Related
I am new to Lua, below is my inline code for "EnvoyFilter". I have spent a couple of hours to search a few articles and posts. But, didn't find any suitable answer, hence posting this question.
The scenario is when I am getting a 503 error code I want to redirect to the login page.
function envoy_on_response(response_handle)
if response_handle:headers():get(":status") == "503" then
#TODO Redirect to http://login-page.com
end
end
Any help or suggestion would be helpful and appreciated.
[Working Answer]
function envoy_on_response(response_handle)
if response_handle:headers():get(":status") == "503" then
response_handle:headers():replace("content-type", "text/html")
response_handle:headers():replace(":status", "307")
response_handle:headers():add("location", "https://login-page.com")
end
end
You could use a 302 Found response to instruct the users browser to make a new request to the login page.
Something like this should work:
First add some logging to validate, that it's working.
Now replace the status field in the header and set it to 302.
Last add a location field to the header, which contains the url you want to redirect to.
function envoy_on_response(response_handle)
if response_handle:headers():get(":status") == "503" then
response_handle:logInfo("Got status 503, redirect to login...")
response_handle:headers():replace(":status", "302")
response_handle:headers():add("location", "http://login-page.com")
end
end
See docs for further inspiration: https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/lua_filter
Having said this I want to add that this might not be a good approach for failure handling. The user will not be informed about the error, but will just be redirected and land on the login page, without knowing why.
What problem are you trying to solve? Maybe there is a better way.
I have created a Shiro Realm to use with x509 certs based on this extension.
The "protected X509AuthenticationInfo doGetX509AuthenticationInfo(X509AuthenticationToken token)" method is executed (i.e. getAuthenticationInfo(token)), validates my user and seems to execute the return X509AuthenticationInfo.
However, after that, the page stays blank! It is not redirected anywhere. If I use instead "anon", or the basic authentication, then my page is displayed correctly (to verify that the page should not be blank). What can be happening?
shiro.ini
[main]
x509Realm = com.flowersforyou.shiro.myRealm
securityManager.realms = $x509Realm
x509 = org.apache.shiro.web.filter.authc.X509AuthenticationFilter
[urls]
/** = x509
EDIT
I tried to use
x509.loginUrl = /err.xhtml
[urls]
/err.xhtml = anon
/** = x509
But it is still showing a blank page so I don't think I was redirected anywhere when the validation failed
EDIT
My answer explains what is possibly happening but now how to fix it. So I suppose that blank page is because something failed (null pointer or whatever). However, I suppose this should raise a 500 error via an Exception, as everything else. When the 500 error is raised, my app will capture it and show a custom error page. This is not happening here. Any solution to capture that error?
I think I have discovered what is happening...
I am missing a Credential Matcher in my .ini:
sha256Matcher = org.apache.shiro.authc.x509.X509CredentialsSha256Matcher
x509Realm.credentialsMatcher = $sha256Matcher
Without this, I suppose the authentication fails (either because there is no matcher set or because it is using a default one that doesn't understand certs but plain passwords) and it is silently finishing with a blank page (perhaps I have to define somewhere where to go if the authentication fails). If someone knows where to do it, or why exactly I am getting a blank page, please tell me to complete the answer.
EDIT
As for the blank page, I found that no exception was being raised. More details here.
I followed this tutorial to index some files in the fileadmin. Now I am at the point "Then manually process the entry: (...)". The problem is that I get this errormessage when I click on the green "refresh-Button":
Can someone tell me what am I doing wrong and why I am not authorized to Crawl through my page as the message: Error: 401 Authorization Required Authorization R... tells me.
By the way: i did not forget to add the user: _cli_crawler .
Thanks in advance
If you have use HTTP Authentication in your project then you can use baseUrl something like below. For more details clike here
http://user:pass#www.mydomain.com/
I think you add htpassword in your site that prevent pages to being indexed.
so remove first htaccess password protection and after try to reindex again.
I added the following code to the localconf.php:
$TYPO3_CONF_VARS['BE']['adminOnly'] = '2';
$TYPO3_CONF_VARS['FE']['pageUnavailable_force'] = '1';
$TYPO3_CONF_VARS['FE']['pageUnavailable_handling'] = 'http://www.somedomain.com/maintenance';
$TYPO3_CONF_VARS['FE']['pageUnavailable_handling_statheader'] = 'HTTP/1.0 503 Service Temporarily Unavailable';
$TYPO3_CONF_VARS['SYS']['devIPmask'] = '127.0.0.1,::1,1.2.3.4';
1.2.3.4 is my IP address. http://www.somedomain.com/maintenance is on another webserver (not the webserver where the TYPO3 installation is). I get the following message Moved Permanently - The document has moved here. How do I make the correct redirect? I tried to put a html-file on the webserver where the TYPO3 installation is, but than I get
Oops, an error occured!
Reason: This page is temporarily unavailable.
Additionally, http://www.domain.com/maintenance.html was not
found while trying to retrieve the error document.
What I'm doing wrong?
The value in pageUnavailable_handling will be fetched by TYPO3, parse and then returned to the browser. Thus if you want to point to another server, then you either have to send a 30x header and do a redirect inside the HTML document or you have to setup a redirect rule within .htaccess.
I would do the later.
REDIRECT should solve your problem.
$TYPO3_CONF_VARS['FE']['pageUnavailable_handling'] = 'REDIRECT:http://www.somedomain.com/maintenance';
Other options are READFILE for static html pages or USER_FUNCTION for, well user functions ;-)
I have a ColdFusion enabled form (for validation) submitting to a separate page. When this form is submitted it is showing me a 404 on the action page, yet when I directly load the action url into the address bar it shows up (errors appear, but that's ok). This is by far one of the most odd issues I have encountered.
Form page: http://www.jefferson.edu/population_health/_archive/contact_me.cfm
Action page: http://www.jefferson.edu/population_health/_archive/contact_action.cfm
Even if I try passing the form variables via URL it gives me a 404.
My gut is that there is another service on that machine that is trying to take over the request whenever you submit data and binding it to another webserver...which, of course, it can't find the right page based on it's own webroot.
If you click http://www.jefferson.edu/population_health/_archive/contact_me.cfm, it loads fine and returns 200 header with IIS as the server, but if you click http://www.jefferson.edu/population_health/_archive/contact_me2.cfm it throws a 404, as expected, but it's properly handled with a custom 404 and the header response is still IIS. But if you click http://www.jefferson.edu/population_health/_archive/contact_me.cfm?foo=bar, it returns an ApacheSling default 404 and header information saying the server is "Day-Servlet-Engine/4.1.12".
Your page is posting to the page contact_action.cfm ... in your question you indicate that the proper page should be "mailaction.cfm".
If the action page is actually mailaction.cfm then you simply need to change the action attribute of your cfform.