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

Routing doesn't work when accessing CSV Importer at subdirectory of a domain #3295

Closed
tenitz opened this issue Apr 25, 2020 · 5 comments
Closed
Labels
stale No replies or comments. Will be auto-closed in 14 days.

Comments

@tenitz
Copy link

tenitz commented Apr 25, 2020

Bug description
I am running Firefly III version 1.0.5 (Docker/develop), and my problem is:

I#m trying to access the CSV Importer at the Public Domain firefly.mydomain.tld/csv via a Nginx Reverse Proxy.

I'm able to access the index page of the CSV Importer at firefly.mydomain.tld/csv, and the corresponding JS and CSS files by setting the environment variable inside the Docker Container like this: ASSET_URL=firefly.mydomain.tld/csv.

But then, on loading the index page, an instant redirect to firefly.mydomain.tld/token instead of firefly.mydomain.tld/csv/token happens because the route() function calls inside resources/views/index.twig return the wrong URLs.

Steps to reproduce
Access CSV Importer on subdirectory of a Domain.

Extra info
Setting the environment like this APP_URL=firefly.mydomain.tld/csv didn't work, since Route seems to not respect this environment variable(#18613).

Maybe grouping and prefixing with a dynamic prefix adjustable through environment variables could be a possible solution.

@JC5 JC5 added the question label Apr 25, 2020
@JC5
Copy link
Member

JC5 commented Apr 26, 2020

Could you share your nginx configuration please?

@Loosper
Copy link

Loosper commented Apr 26, 2020

I am having a similar issue with the app in general. My problem is when I have an nginx reverse proxy that exposes the whole of Firefly III on /firefly/. The whole app works fine except bulk edits which go directly to /transactions/mass/... without the prefix. Also changing the daterange exhibited a similar issue. I managed to track the issue again to route() in the file /firefly-iii/resources/views/v1/javascript/variables.twig.

Here's the proxy I use (might be very wrong, would love suggestions):

location /firefly/ {
    proxy_redirect $scheme://$host/ /firefly;

    proxy_set_header Accept-Encoding "";
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Host $host;

    sub_filter $scheme://$host/ http://$host/firefly/;
    sub_filter_once off;
    proxy_pass http://127.0.0.1:8888/;
}

@tenitz
Copy link
Author

tenitz commented Apr 26, 2020

Could you share your nginx configuration please?

This is my Nginx Configuration for both Firefly and CSV Importer accessible at one subdomain. I'm able to access every website of the CSV Importer at the /csv subfolder, only redirects of the Importer are not working correctly (redirecting to root /<path> instead of /csv/<path>

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name firefly.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    location / {
        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_app firefly;
        set $upstream_port 80;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    location /csv {
        rewrite /csv/(.*) /$1 break;
        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        proxy_pass http://firefly-csv:80;
    }
}

@stale
Copy link

stale bot commented May 3, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale No replies or comments. Will be auto-closed in 14 days. label May 3, 2020
@stale stale bot closed this as completed May 13, 2020
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale No replies or comments. Will be auto-closed in 14 days.
Projects
None yet
Development

No branches or pull requests

3 participants