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

HTTP request failed, statusCode: 504 but works fine on Browser!! #1521

Closed
1 task done
bismarabia opened this issue Jul 14, 2022 · 3 comments
Closed
1 task done

HTTP request failed, statusCode: 504 but works fine on Browser!! #1521

bismarabia opened this issue Jul 14, 2022 · 3 comments

Comments

@bismarabia
Copy link

New Issue Checklist

  • I have searched for a similar issue in the project and found none

Issue Info

Info Value
Platform Name e.g. flutter / ios / android iOS/Android/Desktop
Platform Version e.g. 1.5.0 / 12.0 / 9.0 Any
Dio Version e.g. 2.1.0 / 1.0.17 4.0.6
Android Studio / Xcode Version e.g. Android Studio 3.3.2 / Xcode 10.2.1
Repro rate e.g. all the time (100%) / sometimes x% / only once
Repro with our demo prj e.g. does it happen with our demo project?
Demo project link e.g. link to a demo project that highlights the issue

Issue Description and Steps

I have the following image

https://www.gardeningknowhow.com/wp-content/uploads/2012/10/date-palm.jpg

It works fine on browser

image

but not using this lib

Dio().get(
      "https://www.gardeningknowhow.com/wp-content/uploads/2012/10/date-palm.jpg",
      options: Options(validateStatus: (status) => true),
    ).then((Response value) {
      print("data -> ${value.data}");
      print("headers -> ${value.headers}");
      print("statusCode -> ${value.statusCode}");
      print("statusMessage -> ${value.statusMessage}");
      print("extra -> ${value.extra}");
      print("redirects -> ${value.redirects}");
      print("isRedirect -> ${value.isRedirect}");
      if (value.redirects.isNotEmpty) {
        print("realUri -> ${value.realUri}");
      }

      print("requestOptions.data -> ${value.requestOptions.data}");
      print("requestOptions.baseUrl -> ${value.requestOptions.baseUrl}");
      print("requestOptions.path -> ${value.requestOptions.path}");
      print("requestOptions.queryParameters -> ${value.requestOptions.queryParameters}");
      print("requestOptions.cancelToken -> ${value.requestOptions.cancelToken}");
      print("requestOptions.onReceiveProgress -> ${value.requestOptions.onReceiveProgress}");
      print("requestOptions.onSendProgress -> ${value.requestOptions.onSendProgress}");
      print("requestOptions.connectTimeout -> ${value.requestOptions.connectTimeout}");
});

and gives the following output:

flutter: data ->
flutter: headers -> connection: keep-alive
x-hw: 1657790576.cds026.ma1.hn,1657790576.cds026.ma1.h2c
cache-control: max-age=10
date: Thu, 14 Jul 2022 09:22:56 GMT
accept-ranges: bytes
content-length: 0
flutter: statusCode -> 504
flutter: statusMessage -> Gateway Timeout
flutter: extra -> {}
flutter: redirects -> []
flutter: isRedirect -> false
flutter: requestOptions.data -> null
flutter: requestOptions.baseUrl ->
flutter: requestOptions.path -> https://www.gardeningknowhow.com/wp-content/uploads/2012/10/date-palm.jpg
flutter: requestOptions.queryParameters -> {}
flutter: requestOptions.cancelToken -> null
flutter: requestOptions.onReceiveProgress -> null
flutter: requestOptions.onSendProgress -> null
flutter: requestOptions.connectTimeout -> 0

when I tried in Postman, here is the full raw log:

GET /wp-content/uploads/2012/10/date-palm.jpg HTTP/1.1
User-Agent: PostmanRuntime/7.29.0
Accept: */*
Postman-Token: c1a4f125-aa55-4076-b8f0-1c96b2baa22f
Host: www.gardeningknowhow.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
 
HTTP/1.1 200 OK
Date: Thu, 14 Jul 2022 09:24:20 GMT
Content-Type: image/jpeg
Last-Modified: Mon, 29 Mar 2021 01:24:39 GMT
Accept-Ranges: bytes
CF-Ray: 7242195b8af232ac-CDG
Access-Control-Allow-Origin: *
Cache-Control: max-age=315360000
ETag: "60612c57-95f75"
CF-Cache-Status: DYNAMIC
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
ki-cache-type: None
Ki-CF-Cache-Status: BYPASS
ki-edge: v=17.6
X-Content-Type-Options: nosniff
X-Edge-Location-Klb: 1
Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=VdU8kWcY3vDd6AIvKuLSmvEEUwaGa8skQj4LQlLiJbv2PhNrBmmYw5mdexDwiOApUhrNJPMVAsUU66OQg5lTHwbowSylSRSXERSnG7IE17nJZiW7maM85QVQFiISlGAp8qLrH7WNXU6AWQ%3D%3D"}],"group":"cf-nel","max_age":604800}
NEL: {"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}
Alt-Svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
Server: fbs
Vary: Accept-Encoding
X-HW: 1657790660.cds217.ma1.hn,1657790660.cds040.ma1.c
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 614261

Here is my flutter doctor output

[√] Flutter (Channel beta, 3.1.0-9.0.pre, on Microsoft Windows [Version 10.0.19044.1706], locale en-US)
    • Flutter version 3.1.0-9.0.pre at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f28e570c8c (11 days ago), 2022-06-14 13:39:33 -0500
    • Engine revision 74ee6b5afd
    • Dart version 2.18.0 (build 2.18.0-165.1.beta)
    • DevTools version 2.14.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\dsfs\AppData\Local\Android\sdk
    • Platform android-30, build-tools 29.0.3
    • Java binary at: C:\Program Files\Android\android-studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.1)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.2.32516.85
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 3.5)
    • Android Studio at D:\Softwares\android-studio
    • Flutter plugin version 34.0.2
    • Dart plugin version 183.5901
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] Android Studio (version 4.1)
    • Android Studio at C:\Users\dsfs\OneDrive\Documents\EGDownloads\Compressed\android-studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Android Studio (version 4.2)
    • Android Studio at C:\Program Files\Android\android-studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)

[√] IntelliJ IDEA Ultimate Edition (version 2018.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2018.2.2
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] VS Code (version 1.54.1)
    • VS Code at C:\Users\dsfs\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
       https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19044.1706]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 102.0.5005.115
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 103.0.1264.37

[√] HTTP Host Availability
    • All required HTTP hosts are available

Any idea how to overcome or fix this?

@postflow
Copy link

postflow commented Nov 1, 2022

Hi! I have the same problem. were you able to find a solution?

@bismarabia
Copy link
Author

@AlexV525 why is this issue closed without any comment or fix?

@AlexV525
Copy link
Member

See #1607.

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

3 participants