TYPO3 v10.4.9 News Listview URL-Configuration - url
I´m currently working on a project which uses the news-extension on various pages. To get rid of cryptic URLs, i added the following code to my config.yaml:
routeEnhancers:
News:
type: Extbase
extension: News
plugin: Pi1
routes:
- routePath: '/{news_title}'
_controller: 'News::detail'
_arguments:
news_title: news
defaultController: 'News::detail'
aspects:
news_title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment
This gives me the result i want for some pages but for others, it throws a FE-Error:
(1/1) Symfony\Component\Routing\Exception\InvalidParameterException
Parameter "tx_news_pi1__news" for route "tx_news_pi1_0" must match ".+" ("" given) to generate a corresponding URL.
This error appears on some pages, which include the news-plugin and should show a list view. The weird part is, that as this is a regular page, it should have a regular URL which perfectly works without the code mentioned above. Even more weird is the fact, that i can reach the news-detail page when manually entering the desired speaking-URL. So URL-rewriting for news detail views works on every page but it breaks other list view pages´ URLs that have worked before.
I spent a few hours trying to figure out where the error comes from and found out:
if i change settings.categoryConjunction from OR to AND, the list view works but logically shows wrong results
same thing happens when i change settings.categories i.e when i add a complete category instead of a subcategory
Click me to see backend configuration
Conclusion:
myproject.local/somepagewithnews works
myproject.local/somepagewithnews/detail/articleWithSpeakingUrl works
myproject.local/anotherpagewithnews doesnt work
myproject.local/anotherpagewithnews/articleWithSpeakingUrl works. Note that there appears no /detail/ in between. Adding it will result in a Page does not exist-Error.
Without the code, every page and every news article works with the difference that the article (not the pages with list views) have cryptic URLs.
I hope my issue is understandable and someone here can help me as this is driving me nuts.
Thanks in advance!!
(1/1) Symfony\Component\Routing\Exception\InvalidParameterException
Parameter "tx_news_pi1__news" for route "tx_news_pi1_0" must match
".+" ("" given) to generate a corresponding URL.
The exception says the parameter to generate URL is empty "". You have configured the YAML file to get value from path_segment field to generate url.
news_title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment
Means some of the records have an empty path_segment/slug. That's why exception keeps occurring in some pages only. Check if all the news records has value in path_segment field.
This configuration means that EVERY page of your site must have news item title. You need to limit to a detail page pid by using limitToPages:
routeEnhancers:
News:
limitToPages: [10]
You can add the route for list view:
routes:
- routePath: '/'
_controller: 'News::list'
In the documentation of EXT:news you can find all about the configuration of routes: https://docs.typo3.org/p/georgringer/news/8.5/en-us/AdministratorManual/BestPractice/Routing/Index.html?highlight=routeenhanc
Full configuration from doc:
routeEnhancers:
News:
type: Extbase
extension: News
plugin: Pi1
routes:
- routePath: '/'
_controller: 'News::list'
- routePath: '/page-{page}'
_controller: 'News::list'
_arguments:
page: '#widget_0/currentPage'
- routePath: '/{news-title}'
_controller: 'News::detail'
_arguments:
news-title: news
- routePath: '/{category-name}'
_controller: 'News::list'
_arguments:
category-name: overwriteDemand/categories
- routePath: '/{tag-name}'
_controller: 'News::list'
_arguments:
tag-name: overwriteDemand/tags
defaultController: 'News::list'
defaults:
page: '0'
aspects:
news-title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment
page:
type: StaticRangeMapper
start: '1'
end: '100'
category-name:
type: PersistedAliasMapper
tableName: sys_category
routeFieldName: slug
tag-name:
type: PersistedAliasMapper
tableName: tx_news_domain_model_tag
routeFieldName: slug
Got the same issue.
It seams the problem is
link {
skipControllerAndAction = 1
}
in the tx_news configuration. Simply remove it.
Found this solution here: TYPO3 News routing not working properly...
Related
Zuul prefix when more than a single /path
I have a service with this path http://myhost.com/v2/1234/brand/order/issues/123 that needs to send the actual call to http://anotherhost.com/issues/123. If I want to avoid the solution to write a ZuulFilter Is there a way, with the configuration to say: the prefix is /v2/*/*/order/issues and just use 123? zuul: routes: test2: path: /v2/*/*/orders/issues/** url: http://anotherhost.com/issues/ stripPrefix: true
No, there's no way to configure such behaviour. You need to create custom ZuulFilter By default Zuul will only strip prefixes that do not contain special characters. e.g. zuul: routes: test1: path: /orders/** <--- '/orders' is stripped url: http://anotherhost.com/issues/ test2: path: /*/orders/** <--- nothing is stripped url: http://anotherhost.com/issues/
Authorize redirection loop with FOSOAuth2 and FOSUser
I'm trying to make FOSUserBundle work with FOSOAuthServerBundle , and I'm struggling with oauth_authorize, getting a 302 redirection loop. Here is what I have in my security.yml (simplified): firewalls: oauth_authorize: pattern: ^/oauth/v2/auth form_login: provider: fos_userbundle check_path: /oauth/v2/auth/login_check login_path: /oauth/v2/auth/login access_control: - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } - { path: ^/oauth/v2/auth/login, role: IS_AUTHENTICATED_ANONYMOUSLY } I have to specify the login_path because the default /login doesn't match oauth_authorize pattern. I've added the /oauth/v2/auth/login route in my bundle, but even with a dummy controller, it's never called. I just get 302 redirections until Firefox says it's enough. Someone in the comments here suggested to add $ at the end of the pattern regex, but then the routes doesn't match. The log gives me: security.INFO: An AuthenticationException was thrown; redirecting to authentication entry point. {"exception":"[object] (Symfony\Component\Security\Core\Exception\AuthenticationCredentialsNotFoundException(code: 0): A Token was not found in the TokenStorage. at /home/arthur/PhpstormProjects/rss-api/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AccessListener.php:53)"} [] Am I missing something? EDIT: symfony 3.0 and oauth-server-bundle 1.5
I was indeed missing something, the anonymous directive which prevents the firewall to block the access. firewalls: oauth_authorize: pattern: ^/oauth/v2/auth form_login: provider: fos_userbundle check_path: /oauth/v2/auth/login_check login_path: /oauth/v2/auth/login anonymous: true
Grails resources plugin not resolving Bootstrap CDN urls
I've tried several things: just using the url: resource url: '//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css', disposition: 'head' local url with linkOverride: resource url: '/lib/bootstrap/css/bootstrap.min.css', linkOverride: '//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css', disposition: 'head' using the baseurl mapper config: grails.resources.mappers.baseurl.modules = [ core: "//netdna.bootstrapcdn.com/" ] resource url: 'bootstrap/3.0.0/css/bootstrap.min.css', disposition: 'head' None of these work. I always get some form of Resource not found: //netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css Any help is appreciated.
Co-incidentally I am working on it right now as I see the question. Looks like we have to explicitly use http for the CDN url. resource url: 'http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css' Same goes with linkOverride.
Symfony: deal with "%" escaped symbols in URL
I have Symfony 1.4 web-application. Let's say my app is hosted on example.com and there is FAQ page there. When I refer to my app like this: http://example.com/faq#faq1 everything works fine. But when "#" is escaped: http://example.com/faq%23faq1 I see the following message in log produced by symfony: [err] {sfError404Exception} Empty module and/or action after parsing the URL "/faq#faq1" (/). So, it looks like Symfony recognizes there is "#" but fails to route it correctly. routing.yml: faq: url: /faq param: { module: static, action: faq } requirements: sf_method: [get] How do I make Symfony to route URL with escaped characters correctly?
It's not a Symfony problem. It's not your problem. The problem come from people who escape #. I took few examples: OK - http://www.rue89.com/faq#5.7 NOK - http://www.rue89.com/faq%235.7 OK - http://www.openbsd.org/faq/faq1.html#WhatIs NOK - http://www.openbsd.org/faq/faq1.html%23WhatIs OK - http://www.copyright.gov/help/faq/faq-general.html#register NOK - http://www.copyright.gov/help/faq/faq-general.html%23register Etc ... etc ...
Why does request throw an exception when crawled by googlebot but not when I paste in the URL?
I've been getting a ton of these exceptions in my event log. EVENT ID: 1309 Event code: 3005 Event message: An unhandled exception has occurred. Event time: 12/12/2011 1:40:41 PM Event time (UTC): 12/12/2011 8:40:41 PM Event ID: f85f113a40d349f5a1fe9ef481038281 Event sequence: 8993 Event occurrence: 1463 Event detail code: 0 Application information: Application domain: /LM/W3SVC/12/ROOT-1-129681577057031250 Trust level: Full Application Virtual Path: / Application Path: C:\inetpub\wwwroot\gouki\ Machine name: GOUKIPRIME Process information: Process ID: 7508 Process name: w3wp.exe Account name: IIS APPPOOL\gouki Exception information: Exception type: HttpException Exception message: A potentially dangerous Request.Path value was detected from the client (?). at System.Web.HttpRequest.ValidateInputIfRequiredByConfig() at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context) Request information: Request URL: http://gouki.com/Story/?page=8&orderby=views&tagged=&subject=&author=?page=10&orderby=views,views,views,&tagged=,,,,,,,,,,,,&subject=,,,,,,,,,,,,,,,,,,&author=,,,,,,,,,,,,,, Request path: /Story/?page=8&orderby=views&tagged=&subject=&author= User host address: 66.249.68.81 User: Is authenticated: False Authentication Type: Thread account name: IIS APPPOOL\gouki Thread information: Thread ID: 142 Thread account name: IIS APPPOOL\gouki Is impersonating: False Stack trace: at System.Web.HttpRequest.ValidateInputIfRequiredByConfig() at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context) Custom event details: Connection: Keep-alive Accept: */* Accept-Encoding: gzip,deflate From: googlebot(at)googlebot.com Host: gouki.com User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) I'm not sure where googlebot is picking up the malformed URL (I've tried to no avail to repro on my site), but what I'm more curious about is why this exception is being logged to the event log when if I copy/paste the URL myself (go on, try it), I get no error. Yeah the page is somewhat broken since the parameter values make no sense, and I can see why dual question marks could cause issues, but there is no exception thrown. I've tried changing my user agent to the googlebot, and I still don't see the error. For some reason Asp.net MVC is seeing the first ? as part of the path and not the start of the query string, but only when googlebot is requesting the page. Is there some sort of escaping going on here that I'm not seeing in the event log?
Notice this: Request path: /Story/?page=8&orderby=views&tagged=&subject=&author= The server thinks that the query string parameters is part of the page name, which probably means that the first question mark is actually escaped using %3f, but not shown that way in the error message. A question mark is valid as a separator for the query string, but not as part of the page name. The bot has picked up the URL somewhere, and perhaps tried to fix it. Make sure that you have escaped the URLs properly, i.e. the & should be & when the URL is in an attribute in an HTML element. If you have a relative link like ?page=8&orderby=views&tagged=&subject=&author= in your page, the bot might try to make a complete URL by combining it with the current page URL, which would explain the double sets of query strings. This should normally work, but if there is some problem with the escaping of the URL, it might mess it up.
See this http://geekswithblogs.net/renso/archive/2011/08/26/a-potentially-dangerous-request-value-was-detected-from-the-client.aspx