Skip to content

CSV import does not work in reverse proxy environments #194

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

Closed
hgross opened this issue Aug 16, 2021 · 2 comments
Closed

CSV import does not work in reverse proxy environments #194

hgross opened this issue Aug 16, 2021 · 2 comments

Comments

@hgross
Copy link

hgross commented Aug 16, 2021

The import function for CSV files does not work when octoprint is running in a reverse proxy configuration.

I could trace it down to the file upload function that seems to use the jquery .fileupload() convenience method. The submit() call does not respect the base uri of the api client.

                self.csvImportUploadButton.fileupload({ [...] }); // <-- seems to be the root cause

                self.performCSVImportFromUpload = function() {
                    [...]
                    self.csvImportUploadData.submit(); // <-- does not respect the base url of the API client
                };

My octoprint is behind a nginx reverse proxy at /octoprint. Therefore the correct path for the file upload should be /octoprint/plugin/SpoolManager/importCSV but /plugin/SpoolManager/importCSV is used.
grafik

At first I assumed my input data is invalid, since i converted it from the FilamentManager database, but it does not even arrive on the backend.

This is the UI when the upload fails:
grafik

The baseUrl parameter of self.apiClient looks correct in the debugger:
grafik

@hgross
Copy link
Author

hgross commented Aug 16, 2021

Until this is fixed, a workaround for nginx users is to add a rewrite rule to the wrong /plugin/* paths:

    # fix for plugins that don't respect proxy settings and base urls... (i.e. SpoolManager)
    location  ~ ^/plugin/(?<method>.*)$ {
        return 307 /octoprint/plugin/$method$is_args$args;
    }

Then the import works:
grafik

The QR Codes are also affected by the issue.

@OllisGit OllisGit added status: analysing status: inNextRelease Will be implemented/fixed in next release and removed status: analysing labels Oct 21, 2021
OllisGit added a commit that referenced this issue Oct 24, 2021
- PR #204, #201 redesign of the Spool-Selection in the sidebar. Huge thanks to @TiziG @MarloSM
- E #125 New field "Serialnumber"
- E Spool selection from Edit-Dialog
- E #141 New Filter: Material, Vendor and Color
- E #44 Sidebar filament usage in grams instead of volume

- B #199, #198, #163, #156 some QR-Code optimisations
- B #197, #196, #188, #181, #178, #177, #172, #162, #142,  Some UI optimisations
- B #194 CSV import, behind reverse proxy
- B #175 Confirm dialog not shown
@OllisGit
Copy link
Owner

Hi @hgross ,
in the latest release 1.5.0 I changed some things that could also affect your proxy-setup.

Please try and give me a feedback.
Olli

@OllisGit OllisGit removed the status: inNextRelease Will be implemented/fixed in next release label Jan 7, 2022
@OllisGit OllisGit closed this as completed Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants