Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][FIX] base: serve_fallback infinite redirection #156251

Conversation

fw-bot
Copy link
Contributor

@fw-bot fw-bot commented Mar 4, 2024

Create an attachment with an URL to a static file that does not exists, e.g. '/web/static/idontexist.png'. Inside your browser try to access that file, open localhost:8069/web/static/idontexist.png. The browser fails with a "Too Many Redirections" error.

When a path is not found, nor in the static files, nor in the controllers, _serve_fallback kicks in and attempt to find a resource outside of the router that matches the URL. In case it finds an attachment with a matching URL, it'll deliver it.

In this specific case, it finds our attachment and return a redirection to it's URL, which is the same URL as the request hence it loops back.

Don't deliver URL attachments via _serve_fallback, only deliver stored files.

Description of the issue/feature this PR addresses:

Current behavior before PR:

Desired behavior after PR is merged:


I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

Forward-Port-Of: #154883

Create an attachment with an URL to a static file that does not exists,
e.g. '/web/static/idontexist.png'. Inside your browser try to access
that file, open <localhost:8069/web/static/idontexist.png>. The browser
fails with a "Too Many Redirections" error.

When a path is not found, nor in the static files, nor in the
controllers, `_serve_fallback` kicks in and attempt to find a resource
outside of the router that matches the URL. In case it finds an
attachment with a matching URL, it'll deliver it.

In this specific case, it finds our attachment and return a redirection
to it's URL, which is the same URL as the request hence it loops back.

Don't deliver URL attachments via `_serve_fallback`, only deliver stored
files.

X-original-commit: d2bea59
@robodoo
Copy link
Contributor

robodoo commented Mar 4, 2024

@fw-bot
Copy link
Contributor Author

fw-bot commented Mar 4, 2024

This PR targets saas-16.1 and is part of the forward-port chain. Further PRs will be created up to master.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@robodoo robodoo added the forwardport This PR was created by @fw-bot label Mar 4, 2024
@C3POdoo C3POdoo added the RD research & development, internal work label Mar 4, 2024
robodoo pushed a commit that referenced this pull request Mar 5, 2024
Create an attachment with an URL to a static file that does not exists,
e.g. '/web/static/idontexist.png'. Inside your browser try to access
that file, open <localhost:8069/web/static/idontexist.png>. The browser
fails with a "Too Many Redirections" error.

When a path is not found, nor in the static files, nor in the
controllers, `_serve_fallback` kicks in and attempt to find a resource
outside of the router that matches the URL. In case it finds an
attachment with a matching URL, it'll deliver it.

In this specific case, it finds our attachment and return a redirection
to it's URL, which is the same URL as the request hence it loops back.

Don't deliver URL attachments via `_serve_fallback`, only deliver stored
files.

closes #156251

X-original-commit: d2bea59
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
@robodoo robodoo closed this Mar 5, 2024
@fw-bot fw-bot deleted the saas-16.1-16.0-base-web_image_static_path_404-juc-oqwr-fw branch March 19, 2024 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forwardport This PR was created by @fw-bot RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants