How can I run a docker (pdfviewer-server) over HTTPS?

Hi,

I have installed the docker "syncfusion/pdfviewer-server" on the linux server. If I run the following path it works correctly (the URL name is an example):

http://wspdfviewer.mytest.com:6001/api/pdfviewer

The problem is that the web application runs over HTTPS, and Google Chrome does not allow to call HTTP resources if the web is HTTPS, so it blocks the connection and does not work.

If I try to run the URL over HTTPS it doesn't work, I get the following Chrome error: "This website cannot provide a secure connection".

I have tried to create a hosting for the domain wspdfviewer.mytest.com and install a SSL secure certificate. If I access via HTTPS to

https://wspdfviewer.mytest.com 

 it works correctly, but if I access via HTTPS to

https://wspdfviewer.mytest.com:6001/api/pdfviewer 

it does not work.

Do you know what should I do to make it work correctly?

Thank you very much!


17 Replies

GS GodlinLijo SobiDhas Syncfusion Team July 20, 2022 01:52 PM UTC

Hi Pere,

We have analyzed the reported issue and found that we missed to expose the 443 port in the Dockerfile. This might be the reason for the issue. We have provided the pdfviewer-server project by exposing the 443 port in Dockerfile in attachment and kindly build/run the docker image.


Meanwhile, we will build and publish pdfviewer-server docker image in our docker hub repository with our service-pack release scheduled on the 2nd week of August.


<<pdfviewer-server-project-modified-dockercompose-file>>


If you are still facing the same issue, please provide the environment (production or development) details you tried. Then, it will be helpful for us to analyze further on this issue.


Regards,

Godlin Lijo S




Attachment: pdfviewerserversample_74d0457e.zip


PA Pere Argelich Romà July 20, 2022 02:43 PM UTC

Hi Godlin Lijo S, thank you for the reply.

Is it possible that the docker image that you have attached is not well created? it has a size of 1 MB and instead the one I have downloaded from the Docker HUB has a size of 352 MB.

Once the image is uploaded to Plex Docker (I had to compress it to .tar) the configuration options come out different from the official image in the Docker HUB (images attached).

Am I doing something wrong?

Thank you very much!



Attachment: Images_512d2619.zip



PA Pere Argelich Romà July 21, 2022 07:48 AM UTC

Ok, I understand that I have to create the docker image from the attached files.

I'll try it and let you know if it worked for me.

Thank you very much.



PA Pere Argelich Romà July 21, 2022 10:40 AM UTC

I have created the image and configured it so that port 80 redirects to port 6001, and port 443 redirects to port 6002.

With port 6001 it works correctly, but if I access the url:

https://wspdfviewer.mytest.com:6002/api/pdfviewer 

It does not work and the following error is displayed:

Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Failed to determine the https port for redirect.

Am I doing something wrong?

Thank you very much!



PR Parthipan R Syncfusion Team July 22, 2022 04:45 PM UTC

Hi Pere,


Thank you for your update.


We can configure the HTTPS port mapping in different method and it depends on the application hosted environment. Kindly refer and try the below documentation to configure HTTPS support to an application.


If you are still facing the same issue, we need more details about the DNS/SSL configuration from your side, Then, it will be helpful for us to create your environment and analyze further on this issue.

Please provide the following details,

  • Service hosted environment (Local or cloud machine)
  • DNS configuration details.
  • SSL certificate details (Self signed or certificate authority certificate)
  • Tool used to configure the docker environment variable.
  • If you are using cloud services to host the application, then please share the details about it.


Regards,

Parthipan



PA Pere Argelich Romà July 22, 2022 06:13 PM UTC

Hi Parthipan,

I provide you with the information:

  • Service hosted environment (Local or cloud machine): Cloud machine (VPS Server), using Plex (control panel) and Ubuntu 22.04.
  • DNS configuration details: It is a subdomain that points to the IP of the server where the docker image is running. If you need the exact information you would have to tell me how I can pass it to you privately.
  • SSL certificate details (Self signed or certificate authority certificate): Certificate Let's Encrypt installed to the subdomain.
  • Tool used to configure the docker environment variable: The official Plex Docker extension.
  • If you are using cloud services to host the application, then please share the details about it: The application runs on another server, but does not interfere with the operation of the web service over https.


If you want to test directly with the control panel of my test server, you can ask me privately for the information.

If you need more information do not hesitate to ask me.

Thank you very much!



PA Pere Argelich Romà July 25, 2022 09:52 AM UTC

Hi,

With the instructions in the first link (Hosting ASP.NET Core images with Docker over HTTPS) I managed to make it work over https (in red, not secure).

Now I have to try using the url in the code and see if with Chrome it works correctly.

Thank you very much!



PR Parthipan R Syncfusion Team July 25, 2022 10:45 AM UTC

Hi Pere,


Thanks for your update.


We are glad to hear that you run the docker container over HTTPS with the help of shared documentation. Please let us know if any other concerns about it.  


Regards,

Parthipan



PA Pere Argelich Romà July 25, 2022 02:37 PM UTC

Hi,

I have been able to test it and it works correctly!


I only have a couple of doubts:

1. The URL in Chrome comes out as https (in red, not secure). Chrome does not show any error in the debug console. I understand that there is no problem that it marks it as https in red (not secure) instead of https in green (secure) for the correct functioning of the web service?

2. The DocumentEditor add-on also uses a docker image, can you do the same update to make it work over HTTPS?


Thank you very much!



AC ArunKumar Chandrakesan Syncfusion Team July 26, 2022 06:45 AM UTC

Hi pere,

 

Sorry for the inconvenience, we are facing some difficulty in validating the issue and We will analyze further on this and update you with more details on July 27, 2022.Thanks for your patience.

 

Regards,

Arun Kumar



PA Pere Argelich Romà July 26, 2022 07:01 AM UTC

Hi Arun Kumar,

I managed to get the https URL working with a valid certificate (green color in Chrome).

The only question is if you can make the same update so that the Docker image of the DocumentEditor also works over https.

Thank you very much!



SM Suriya Murugan Syncfusion Team July 27, 2022 11:53 AM UTC

Hi Pere,


Please get the document editor docker project from below linkand it also works over https.

https://www.syncfusion.com/downloads/support/directtrac/general/ze/ej2-documenteditor-server-2026359981



Regards,

Suriya M.



PA Pere Argelich Romà July 27, 2022 01:28 PM UTC

Thank you very much Suriya!



AC ArunKumar Chandrakesan Syncfusion Team July 28, 2022 09:34 AM UTC

Hi Pere,

 

Thank you for your response

 

Regards,

Arun Kumar



RK Rich Kalsky replied to Pere Argelich Romà June 28, 2023 05:11 PM UTC

What did you finally do to get it all to work over https?

My command is

 docker run --name syncfusion -d -p 6001:80 -p 6002:443 --restart=unless-stopped -e SYNCFUSION_LICENSE_KEY="N.....c=" syncfusion/pdfviewer-server:latest


I can reach it via http by IP and name, but I cannot reach it using https (red/green/whatever).



PA Pere Argelich Romà replied to Rich Kalsky June 29, 2023 09:49 AM UTC

Configuring the docker as shown in the image attached and using your own certificate.



Attachment: Image_8fe0340d.zip


CK Chinnamunia Karthik Chinna Thambi Syncfusion Team replied to Rich Kalsky July 4, 2023 01:17 PM UTC

To enable HTTPS in your local environment, please follow these steps:

 

  • Open PowerShell.
  • Execute the following commands, one by one, to add the SSL certificate to your environment. Here, CREDENTIAL_PLACEHOLDER is the password.

 

 

  • dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\aspnetapp.pfx -p <CREDENTIAL_PLACEHOLDER>

 

  • dotnet dev-certs https --trust

 

  • Please use the below commands to run the PDF Viewer docker image. Here, pdfviewerserver is the docker image name.

 

 

  • docker pull syncfusion/pdfviewer-server

 

  • docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORT=8001 -e ASPNETCORE_Kestrel__Certificates__Default__Password="<CREDENTIAL_PLACEHOLDER>" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v $env:USERPROFILE\.aspnet\https:/https/ pdfviewerserver

 

By following these steps, you will be able to run the PDF Viewer docker image with both HTTP and HTTPS ports. The HTTP port will be accessible at http://localhost:8000/api/pdfviewer, and the HTTPS port will be accessible at https://localhost:8001/api/pdfviewer.

 

 

Screenshot:

 


Loader.
Up arrow icon