Downloading a https file in play framework works in development but not in production
NickName:Omar Wagih Ask DateTime:2016-12-01T09:51:12

Downloading a https file in play framework works in development but not in production

I'm trying to download a dropbox link to a file output.txt. Something like this:

URL link = new URL("https://dl.dropboxusercontent.com/1/view/XXX/file.txt");
ReadableByteChannel rbc = Channels.newChannel(link.openStream());
FileOutputStream fos = new FileOutputStream("output.txt");
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);

When I'm running my app in development (i.e. activator run) this works fine. When the app is staged and deployed in production, I get a connection timeout at the link.openStream() step:

play.api.UnexpectedException: Unexpected exception[ConnectException: Connection timed out]

I'm able to save any http files or websites to file in production. It just seems to time out on any https file. Any thoughts on how I could begin to tackle this?

Does this have anything to do with play or is it a configuration issue with my apache server?

Thanks

Copyright Notice:Content Author:「Omar Wagih」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40901337/downloading-a-https-file-in-play-framework-works-in-development-but-not-in-produ

More about “Downloading a https file in play framework works in development but not in production” related questions

Downloading a https file in play framework works in development but not in production

I'm trying to download a dropbox link to a file output.txt. Something like this: URL link = new URL("https://dl.dropboxusercontent.com/1/view/XXX/file.txt"); ReadableByteChannel rbc = Channels.

Show Detail

Play! Framework: Assets not accessible in Production Mode

So I researched and found out that Play's Production mode has a different behavior when dealing with assets than it does in Development mode. I have a site where the user uploads an image and the ...

Show Detail

Play Framework: Different favicon in production and dev modes

I have a Play Framework 2.1.0 application, and the favicon in production mode is the default Play Framework icon, whereas in development it is an icon I have defined. The same route gives me the de...

Show Detail

How can I run Play framework in HTTPS only in the dev mode?

I'd like to run Play Framework over HTTPS only in the development mode and I've done so using the following bit of configuration: https.port=9443 trustmanager.algorithm=JKS keystore.file=conf/

Show Detail

Is there a default method to read a file in play which works even in the production environment?

I am using play framework with java to develop a web application. I have wanted to read a file at the run time and the file has been included in a folder in the project. But at the production envir...

Show Detail

play framework: no assets in production mode

I have a strange problem. I have an app written in Play! framework 2.0.4. It uses some public assets (css/images/javascript). Everything's fine when I run it in development mode: blus@vmblus:~/svn...

Show Detail

How to start unsecured Play Server in Production mode

I'm developing a web server using Play Framework v2.5. It will run in intranet and will use HTTP, not HTTPS. When I start Play Server in Development Mode, it works. But in Production Mode Play Se...

Show Detail

Play framework production reverse routing

I am trying to set up my Play project so that some routes that are for development purposes only do not show up in production but I am having difficulty with the reverse routing. Here are my route...

Show Detail

Play Framework Compile sass file manually

My question is quite simple, I am using play framework 2.4 with scala and assetSASS, I want to allow users to create their owns css so I have several scss files that I import and override default

Show Detail

Running the play framework in development mode in the background

I need to find a way to run the play framework in development mode (the usual 'play run' command) but have it run in the background instead of being attached to a terminal. Unfortunately 'play run ...

Show Detail