Jump to content

Installing SSL + HTTPS using a reverse proxy like caddy on Android


Go to solution Solved by seanbuff,

Recommended Posts

pwhodges
Posted

Is that the whole Caddyfile?

Paul

pwhodges
Posted

Actually, checking Caddy's documentation, my suggestion was in fact wrong (I only used that format in Caddy v1, and it behaves differently now).  Use Q-Droid's solution by adding:

{
   http_port  8080
   https_port 8443
)

as a separate block at the start of the Caddyfile.

Paul

Posted (edited)

Like this ?

 

ziomario.ns0.it {
               http_port 8080
               https_port 8443
               encode
               reverse_proxy 192.168.1.6:8096
}

 

Edited by ziomario
Posted

it's not good. Error is : unrecognized directive : http_port

Posted

Global options are a separate block so it would be like this:

# global options
{
    http_port 8080
    https_port 8443
}
# reverse proxy for ziomario
ziomario.ns0.it {
               encode
               reverse_proxy 192.168.1.6:8096
}
 

Posted (edited)

Running the script without sudo still does not work. Errors is :

ERROR : tls.obtain will retry error ziomario.ns0.it solving challenge authorization failed HTTP 400 urn:iert.params acme error connection: connection refused.

Ports opened on the router are :

 

Caddy-HTTPS
PC192.168.1.6
TCP/UDP
8443

Caddy-HTTP
PC192.168.1.6
TCP/UDP
8080

Emby-Android
PC192.168.1.6
TCP/UDP
8096

Emby-Android
PC192.168.1.6
TCP/UDP
8920

HTTP
PC192.168.1.6
TCP/UDP
80

HTTPS
PC192.168.1.6
TCP/UDP
443
 
Using sudo in the script,instead,to connect to the Emby server I should use port 8443 :
 
 
While before,I didn't have to write the port. It was cleaner to open the website like this :
 
Edited by ziomario
pwhodges
Posted (edited)

In the router, open ports 80 & 443 (and no others), forwarding them to PC192.168.1.6, ports 8080 & 8443.  This will be accessed without specifying a port - just https: .

In Caddy, reverse proxy using the http port set in Emby (8096), specifying http (reverse_proxy http://192.168.1.6:8096).  The https port isn't used, as Emby is not doing https (Caddy is), and the Emby security setting should say "handled by reverse proxy".

Why have you got encode in your Caddyfile?  I don't think it will be useful.

Paul

Edited by pwhodges
Posted (edited)

---> In the router, open ports 80 & 443 (and no others), forwarding them to PC192.168.1.6, ports 8080 & 8443.

what this mean ? I can't do what you suggest. For me open ports means forward them. To open and to forward are the same action.

Check the attached image.

 

Istantanea_2024-08-16_19-00-18.jpg

Edited by ziomario
Posted

Pay attention, read and try to understand what's posted. 

You only need the bottom two entries, not the others. AND for 80 change the destination port to 8080. AND for 443 change the destination port to 8443.

You are opening, forwarding and translating the port values. 

Posted (edited)

Nope man. It does not work. The only thing I can do is to disable port 80 and 443. But I get the same error as before...

 

Istantanea_2024-08-16_19-00-18.jpg

Senza titolo.jpeg

Edited by ziomario
Posted

Should also remove port 8096 and 8920 ?

Posted

You need two entries/lines in your router. 

LAN port 8080, public port 80.

LAN port 8443, public port 443.

Posted (edited)

like this one,ok...

 

Istantanea_2024-08-16_21-03-28.jpg

Edited by ziomario
pwhodges
Posted

JUST TWO LINES as mentioned in several posts.  REMOVE the lines referring to Emby.  The only connections from the outside will be for Caddy (with the settings you now have), which is then solely responsible for passing data on to Emby through the reverse_proxy command.

Paul

  • Like 1
  • 2 weeks later...
Posted

have you figured this out now?

Posted (edited)

Nope. I'm still waiting for your help to understand how to use the Emby.pfx file. I still asking myself what's your role in the emby project. I see you rarely and usually you give some mild help. Now I think that you want only to know if the problem has been fixed to close the thread,right ? Is this your role ? To observe,to let that others help and find the solutions without taking part to the discussion and to close the threads ?

 
Edited by ziomario
Posted
4 hours ago, ziomario said:

I'm still waiting for your help to understand how to use the Emby.pfx file.

If you're using Caddy now you don't need the Emby pfx file. Caddy takes care of that.

  • Agree 1
Posted

I'm not married with Caddy. Plus,I want to learn + I don't like to leave any problem unresolved.

  • Like 1
seanbuff
Posted
1 hour ago, ziomario said:

I'm not married with Caddy. Plus,I want to learn + I don't like to leave any problem unresolved.

You opened this topic specifically asking for help installing a reverse proxy, namely Caddy. In this instance, the use of Caddy would negate having to mess with external certs and .pfx files and having to constantly generate new ones when they expire. As has been mentioned, Caddy handles all of this for you, automatically.

If however, you would prefer to add the complication of managing certificates yourself via pfx files, I would suggest opening a separate topic for the issues you are experiencing with that. Thanks.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...