-
Notifications
You must be signed in to change notification settings - Fork 642
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
Export button doesn't work on custom URL #5558
Comments
Hm, in this case it should definitely work correctly, since element exporting happens via control panel URLs (whereas in #4737, the real issue there is that GraphQL API requests are technically considered “site” requests – so site URLs are used for action URLs). Try opening up your browser console and outputting the following things: |
The URLs seem to correspond to the custom URL of the dashboard: |
Yeah that looks right. Keep an eye on your Network tab when you click the Export button inside the export modal. Can you tell me which request is going to the wrong domain? |
For what it's worth, the "reset password URL" button shows a wrong URL on our production environment. This doesn't happen on our staging environment (where exporting fails too) – but it is possible that some root URL / asset URL etc. is set incorrectly which causes both problems? |
In your console, what does this output? Craft.getCpUrl('', {token: 'test'}); |
Huh, I wonder why that is 301’ing then. Try running this from your terminal – what is returned? curl -I https://kebap-1068.cms.staging.karriere.at/admin?token=test |
Very weird. That seems to be the root of your issue though. Here’s how it’s supposed to work:
cms/src/web/assets/cp/src/js/BaseElementIndex.js Lines 1806 to 1809 in 4d11acc
In your case though, instead of getting routed to the ExportController, something is causing that 301 response to come back instead, which is causing the browser to actually redirect itself, rather than downloading a file. Is there anything in your web server config that could be causing that 301 to be returned, that you can think of? |
Turns out the first "step" returns a
DevOps changed that, and now the first "step" returns a Might be interesting to include the number of "steps" that Craft should try for a request before "giving up" as a config parameter? We're probably not the only ones running Craft with a custom URL and a specific NGINX configuration. Anyways, thanks for much for the help @brandonkelly! Much appreciated. |
Ah, that makes sense. You might have better luck if you enable the addTrailingSlashesToUrls config setting, so Craft-generated URLs have trailing slashes to begin with.
Yeah… currently it’s just relying on typical browser behavior of not redirecting the request if the link is for a file download. But there’s probably a better way. |
(Leaving this open as I do think we can improve it.) |
Sorry! 🙈 |
n.b. am sure it's obvious, but curl's -L could be a good model - it's very useful in cases like this, for example when there's an http->https bump in the road... |
@martinhellwagner I believe I’ve just fixed this for the next release. Would you mind testing on your end? To get the fix early, change your "require": {
"craftcms/cms": "dev-develop#b6bd1c4148ea402059d5c0fe168382863cf7c30f as 3.4.3",
"...": "..."
} Then run |
Craft 3.4.4 is out now with that fix. Let me know if it works for you. |
@brandonkelly Looks good! Thank you! 👍 |
Sweet! |
Description
Similar to #4737, the export of entries is not working when using Craft CMS with a custom URL (e.g. https://cms.customurl.com/admin). When trying to export directly from the server URL (e.g. http://serverurl.com/admin), everything works as expected. I might be good to note that the custom URL has an SSL certificate, while the server URL does not.
Steps to reproduce
Additional info
The text was updated successfully, but these errors were encountered: