Large file uploads with ssl on Phoenix 1.6

Hello everyone,

I am having some trouble uploading large file with https enabled on Phoenix 1.6

It seems to be related to ssl, as the http support large files, but not https.

I have tried some config…

# In the endpoint
  plug Plug.Parsers,
    # parsers: [:urlencoded, :multipart, :json],
    parsers: [
      { :multipart, length: 100_000_000_000 },

# In config/dev.exs
  https: [
    port: 4001,
    protocol_options: [
      idle_timeout: 6_000_000,
      request_timeout: 6_000_000,
    cipher_suite: :strong,
    certfile: "priv/cert/selfsigned.pem",
    keyfile: "priv/cert/selfsigned_key.pem",
    otp_app: :uploads_mvp

# In config/config.exs, for waffle
# Waffle
config :waffle,
  storage: Waffle.Storage.Local,
  asset_host: "localhost:4000",
  # Increase waffle timeout
  # version_timeout: 120_000
  version_timeout: 6_000_000

but when uploading on https, browser seems to hang (firefox, chrome) without warning or error

There is this related unsolved topic…

Does anyone have the same issue? It’s hard to debug because there are no logged error.

I made a sample repo to illustrate…

Thanks for taking time

1 Like

I think I had to add this hack to my app after upgrading to 1.6:

  plug Plug.Parsers,
    parsers: [:urlencoded, :multipart, :json],
    pass: ["*/*"],
    json_decoder: Phoenix.json_library(),
    # The default of 8MB is not enough (why?).
    length: 32_000_000

I am transferring an HTML page as part of the form, but it’s definitely not that big. Not sure if this is related, haven’t investigated the reason. Locally I’m running over HTTPS.

1 Like

Thank You for the suggestion.

I tried the configuration, but it still fails. Browsers hang after 800ms.

http is working fine with large files (around some gigas)

but not https

Have you tried reproducing the issue with curl just to confirm that it isn’t some weird issue with the browser?

1 Like

I have tried with Firefox and Chrome, but not with curl yet :slight_smile:

I will try and report the result.

Thanks for your reply.