Code Monkey home page Code Monkey logo

redirecthandler's Introduction

The Neos package

Note

This repository is a read-only subsplit of a package that is part of the Neos project (learn more on www.neos.io).

Neos is an open source Content Application Platform based on Flow. A set of core Content Management features is resting within a larger context that allows you to build a perfectly customized experience for your users.

If you want to use Neos, please have a look at the Neos documentation

Contribute

If you want to contribute to Neos, please have a look at https://github.com/neos/neos-development-collection - it is the repository used for development and all pull requests should go into it.

Build frontend assets

If you need to rebuild the frontend assets you need to run the following commands within the Neos.Neos package directory:

For develpment:

yarn
yarn build

For production:

yarn
yarn build:production

redirecthandler's People

Contributors

2case avatar aertmann avatar albe avatar daniellienert avatar dfeyer avatar dlubitz avatar gerhard-boden avatar jonathan2022bausch avatar kdambekalns avatar kitsunet avatar mficzel avatar nikdro avatar sebobo avatar thomas-buhk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

redirecthandler's Issues

Redirect Handler fails when trying to fix the same wrong name

Jira issue originally created by user @daniellienert:

Situation:

The editor adds a new page and doesn't alter the title which results in the path-segment "unnamed". She then renames the path-segment later to something meaningful. The old path segement "unnamed" gets stored in the redirect table.

When the same thing above happens again (which is not unlikely) - everything works fine until the path-segemnt is changed and the editor tries to publish. This results in a 500 with the following exception:

Exception #1382091456 in line 147 of /var/www/surf/releases/20160523131755/Data/Temporary/Production/SubContextJail/Cache/Code/Flow*Object_Classes/Neos_RedirectHandler_DatabaseStorage*RedirectStorage.php: A redirect exists for the source URI path "de/blog/2016/unnamed.html", please remove it first.

As this can only be done with DB Access / console access - we need a solution where the editor can help herself.

Jira-URL: https://jira.neos.io/browse/NEOS-1836

Moving Shortcut nodes that are linking to first child fails

This is the error that I get on Neos 2.3:

Exception #1451945358 in line 140 of /data/www/releases/current/Data/Temporary/Production/Cache/Code/Flow_Object_Classes/Neos_RedirectHandler_NeosAdapter_Service_NodeRedirectService.php: The target URI path of the node could not be resolved

49 Neos\RedirectHandler\NeosAdapter\Service\NodeRedirectService_Original::createRedirectsForPublishedNode(TYPO3\TYPO3CR\Domain\Model\Node, TYPO3\TYPO3CR\Domain\Model\Workspace)

Redirect for host without any source path

Hi,
currently I think it's not possible to add a redirect without any source path? Of cause I can do this by server configuration but I think it would be nice to add this functionality in this package.

Scenario:
I need a redirect for a host only if there is no request path. This redirect should only match if there is no request path

Example:
redirect should match for:

redirect should not match for:

Also there should be the possibility to add a redirect for a host which matches for all possible request paths, something like https://mydomain.tld/* but this is not my current issue.

Redirects not working

Hi there,

it seems redirects don't work anymore. I haven't worked with Neos in the last few months but I guess I tried everything.
The website I'm currently working on was Neos 7.1, but even after an update nothing changed.

Installed versions:
neos/neos 7.3.5
neos/redirecthandler 5.0.2
neos/redirecthandler-databasestorage 5.0.2
neos/redirecthandler-neosadapter 4.3.1
neos/redirecthandler-ui 2.4.6

For testing purposes I removed every package that wasn't needed.
I removed .html as defaultUriSuffix.
I added the configuration from the README.
I searched the Neos Slack and found others with the same problem.
I created an empty Neos site (from master (so Neos 8?) like explained here.

Locally I'm using the standalone development server, in production it's Apache. In the past I had a Docker setup with nginx on my machine and nginx in production, which worked like a charm. :)

Just wanted to let you guys know that there might be a problem with some setups. Or maybe in generell? I will try my old setup with nginx later this week.

Add redirect "Type" information

In context of Neos, at least two different providers of redirect entries exist.

  1. Automatic generated by node or resource changes in the Neos Backend
  2. Manually created via CLI import or the Redirect.Ui

It would be really helpful if these types could be filtered if needed.

Routing "wins" over redirect

Behaviour

Assuming

  1. a node exists and is visible in Neos
  2. a redirect is (manually) added that redirects the URL of that node somewhere else

then the redirect is not used as long as the node is not hidden.

If the redirect component (tried it on Neos 4.3 ๐Ÿ‘ป) is moved before routing (instead of after routing, it works.

Question

This is the intended behaviour, looking at the check for possible routing results (in the middleware and the component)

But what is what people expect? At least I stumbled over this because a customer notified me of a "bug" โ€“ so the behaviour is not crystal clear to everyone.

Possible solution

One way is to adjust the position through the configuration, that is even documented (but it could be worded differently for Neos, and/or put in the neos/redirecthandler-neosadapter documentation, too.

Add new feature to redirect for base URL

As a developer, I want to add new feature to be possible to redirect for base URL. For example:
./flow redirect:add --source=/ --target=under-construction.html --status-code=302
So when we access http://www.example.com it should redirect to http://www.example.com/under-construction.html
Reason to have this feature to prevent any incident errors during deploy the new release to production.

410 redirects end up in an exception

410 redirects end up in an uncaught exception. IMO they should be logged (as a INFO or smth), but not just thrown.

Exception in line 66 of /data/releases/current/Data/Temporary/Production/Cache/Code/Flow_Object_Classes/Neos_RedirectHandler_RedirectService.php: 

9 Neos\RedirectHandler\RedirectService_Original::buildResponse(Neos\Flow\Http\Request, Neos\RedirectHandler\Redirect_Original)
8 Neos\RedirectHandler\RedirectService_Original::buildResponseIfApplicable(Neos\Flow\Http\Request)
7 call_user_func_array(array|2|, array|1|)
6 Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy::__call("buildResponseIfApplicable", array|1|)
5 Neos\RedirectHandler\RedirectComponent_Original::handle(Neos\Flow\Http\Component\ComponentContext)
4 Neos\Flow\Http\Component\ComponentChain_Original::handle(Neos\Flow\Http\Component\ComponentContext)
3 Neos\Flow\Http\Component\ComponentChain_Original::handle(Neos\Flow\Http\Component\ComponentContext)
2 Neos\Flow\Http\RequestHandler::handleRequest()
1 Neos\Flow\Core\Bootstrap::run()


HTTP REQUEST:
GET /a/vecher-pamyati.html?ajax=true HTTP/1.1
Host: psmb.ru
Accept-Encoding: gzip,deflate,br
User-Agent: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
From: googlebot(at)googlebot.com
Accept: */*,*/*
Accept-Language: en-US
Referer: https://psmb.ru/a/vecher-pamyati.html?currentPage=2
X-Forwarded-Proto: https
X-Forwarded-For: 66.249.76.63
X-Real-Ip: 66.249.76.63
Connection: close
Content-Length: 
Content-Type: 



HTTP RESPONSE:
[response was empty]

PHP PROCESS:
Inode: 2428116
PID: 24827
UID: 80
GID: 80
User: www-data

    [array] => 

Redirect Handler doctrine:migrationgenerate "error"

After adding the package and migration the DB, we get this autogenerated line in every doctrine:migrationgenerate we do:

$this->addSql('DROP INDEX sourceuripathhash ON neos_redirecthandler_databasestorage_domain_model_redirect');

Seems that a notification is missing or a table get created by old migrations files but is not used anymore?

Set redirect status for "redirect" to 301

Currently the default is 307 which is a temporary redirect.

I propose changing this to 301 (Moved permanently) as most sites and even the RedirectHandler ui package override this and set it to 301.

Pre-existing redirect in different node dimension are overriden

Jira issue originally created by user @gerhard-boden:

Testcase:
We have an existing redirect like: someoldsite.html that points to de/newcontent in the german content dimension.

When activating a previously hidden document /en/newcontentin the english dimension the following redirects are generated:
de/newcontent => en/newcontent (unwanted, but does at least not do anything since the german page exists)

AND

someoldsite.html => en/newcontent. The former redirect to de/newcontent deleted.

Jira-URL: https://jira.neos.io/browse/NEOS-1869

Escaping of brackets "(" and ")" in redirect for assets

Description

Replacing assets in Backend of files with brackets in the filename doesn't do the redirect correctly. I think the problem lies either in the encoding of the sourcepath for inserting into the database table or in the decoding of the redirect.
This is an example on how it is stored in the database:
_Resources/Persistent/9/0/f/f/90ffd2359008d82298821d16b21778c5c39aec36/Table%20rates%20%28Status%20as%20of%2030%20September%202021%29.pdf

This is how it tries to find the entry in the database (I think it uses the function getOneBySourceUriPathAndHost from redirectStorage):
/_Resources/Persistent/9/0/f/f/90ffd2359008d82298821d16b21778c5c39aec36/Table%20rates%20(Status%20as%20of%2030%20September%202021).pdf

As you can see the Brackets () are either not correctly saved in the database or it is not decoding correctly in the redirect.

Steps to Reproduce

  1. Upload Asset with a filename that contains brackets and open it in a browser (in my case I used a pdf)
  2. Use the replace asset function, check both checkboxes (keep filename and do the redirect of the old url)
  3. reload the asset in browser (the link to the resource)
  4. It loads a 404 site instead of redirecting to the new resource

Expected behavior

Loading old resource url should redirect me to the new resource

Actual behavior

It leads to a 404

Affected Versions

Neos: 5.3
Flow: 6.3

RedirectHandler does not respect content fallback dimensions

Jira issue originally created by user @johannessteu:

If you publish a workspace and the redirecthandler package is installed it will check if a redirect should be added. Therefore it generates the URL for that node. The node only contains the targetdimensions without possible fallbacks for the content dimensions. If there is no sitenode for that dimension the uriBuilder won't be able to generate a url and an exception is thrown.

Something similar is fixed with neos/neos-development-collection#512 for the PublishingService.

Jira-URL: https://jira.neos.io/browse/NEOS-1830

Add author field for redirects

Storing the author of a redirect as optional text field is helpful in projects in which multiple people work on them.

I wouldn't do this as a reference to an account object as redirects can be imported and exported.

RedirectHandler escapes ? to %3F

I tried to shorten an UTM url, but the redirect handler doesn't handle ? well.
In source path I entered: article/ix575ph2epxqj where ix57... is the random part of the node-name.
In target path I entered: valid/path/to/my/document.html?utm_medium=foo&utm_source=bar
The redirect handler redirects me from https://mysite.com/article/ix575ph2epxqj to https://mysite.com/valid/path/to/my/document.html%3Futm_medium=foo&utm_source=bar which gives me a 404 - not found.

https://mysite.com/valid/path/to/my/document.html is a valid url and manually browsing it serves me a rendered document node. Therefore, https://mysite.com/valid/path/to/my/document.html%3Futm_medium=foo&utm_source=bar serves me a correctly rendered document node, too, if I open it manually. So, it's not a problem of a missing document node or wrong URI.

  • Neos.Neos 5.1.9
  • Neos.Flow 6.1.7
  • Neos.RedirectHandler 4.0.3

Support Flow 6 PSR-7

The RedirectService needs to be adapted to PSR-7.
This will require a separate major version as it will not be compatible with Flow 5.

Imported .csv doesn't get removed from persistent resources

It looks like the imported .csv File gets deleted but not the record?

Steps to reproduce

  • Import a CSV-File
  • Run ./flow resource:clean
Found 1 broken resource(s):
URL Redirects - after-neos-redirects.csv (d443ea2dfecb898aa9e83e67be52a64849804236) from "persistent" collection

Redirects are not handled if node is hidden

If a document node is hidden, the redirect handler does not perform the redirect and a 404 is triggered.

From the perspective of the user, the URL of the (hidden) page does no longer exist in the frontend and if a redirect is defined, it should do a redirect to the defined target.

URLs with bracket can't be imported

A URL can also have brackets []. But it is not possible to import them, as the systems say the URL is not valid.

!! Source path "persoenliche-beratung/clinic[bonn]-1/clinic[augsburg]-1/topicsMen[body1]-1" does not have a valid format

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.