How can i enable HTTPS over a Snap server?

Deck Pope

is there a simple example on enabling HTTPS in a Snap server? I am not that into OpenSsl and its usage with Snap. Thanks

Juan Pablo Santos

JP Moresmau showed you how to enable it from the command line, but doing the same programatically is just as easy. The function that starts Snap's "main loop" takes a configuration parameter as the first argument as you can see in this bit of documentation. You can simply call defaultConfig from the Snap.Http.Server.Config module and then call setSSLPort, setCert and setSSLKey on it. Then you can pass this new config to httpServe as the first argument. If you used snap init you can find all the relevant code in your src/Main.hs.

As you can see here, the default config is created from the command line using a description of options. So changing the defaultConfig is exactly the same as passing commandline arguments.

What I find slightly odd is that there's no defaultSSLConfig that generates a self-signed certificate so you can try SSL quickly. Also, it's odd the certificate and keys are of type FilePath. Maybe it's a good pull request for the Snap team to check?

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I enable auto-completion for the snap command?

From Dev

How can I enable remote debugging in MS SQL Server 2008?

From Dev

How can I enable MSSQL support for PHP on a Linux server?

From Dev

How can I enable wol on Ubuntu server 16.04?

From Dev

How can I enable the power button on my server?

From Dev

How can I make items snap to a grid?

From Dev

How can I change or hide the ~/snap directory?

From Dev

How can I update all Snap packages?

From Dev

How can I create an architecture independent snap?

From Dev

How can I change or hide the ~/snap directory?

From Dev

How do I enable https support in libcurl?

From Dev

How can I host my CSS/JS on an HTTPS server

From Dev

How can I run a https server on Heroku with docker?

From Dev

How can a I redirect an HTTPS request to a HTTP server?

From Dev

How can I enable moodle?

From Dev

How can I enable MultiPartFeature?

From Dev

How can I enable BinaryLiterals?

From Dev

How can I enable zswap?

From Dev

How can I enable zswap?

From Dev

How can I enable moodle?

From Dev

How can I enable a fieldset?

From Dev

SQL Server : How can I enable/reconfigure xp_cmdshell through a linked server

From Dev

How can I enable font smoothing when I connect to a Windows server with Terminal Services Client?

From Dev

How can I enable font smoothing when I connect to a Windows server with Terminal Services Client?

From Dev

How to enable GZIP in my tomcat server having Https/ssl

From Dev

I can not connect to https waitress wsgi server

From Dev

I can not connect to https waitress wsgi server

From Dev

How can I manage and deploy snap packages without using the official Snap store from Canonical?

From Dev

How can I manage and deploy snap packages without using the official Snap store from Canonical?

Related Related

  1. 1

    How can I enable auto-completion for the snap command?

  2. 2

    How can I enable remote debugging in MS SQL Server 2008?

  3. 3

    How can I enable MSSQL support for PHP on a Linux server?

  4. 4

    How can I enable wol on Ubuntu server 16.04?

  5. 5

    How can I enable the power button on my server?

  6. 6

    How can I make items snap to a grid?

  7. 7

    How can I change or hide the ~/snap directory?

  8. 8

    How can I update all Snap packages?

  9. 9

    How can I create an architecture independent snap?

  10. 10

    How can I change or hide the ~/snap directory?

  11. 11

    How do I enable https support in libcurl?

  12. 12

    How can I host my CSS/JS on an HTTPS server

  13. 13

    How can I run a https server on Heroku with docker?

  14. 14

    How can a I redirect an HTTPS request to a HTTP server?

  15. 15

    How can I enable moodle?

  16. 16

    How can I enable MultiPartFeature?

  17. 17

    How can I enable BinaryLiterals?

  18. 18

    How can I enable zswap?

  19. 19

    How can I enable zswap?

  20. 20

    How can I enable moodle?

  21. 21

    How can I enable a fieldset?

  22. 22

    SQL Server : How can I enable/reconfigure xp_cmdshell through a linked server

  23. 23

    How can I enable font smoothing when I connect to a Windows server with Terminal Services Client?

  24. 24

    How can I enable font smoothing when I connect to a Windows server with Terminal Services Client?

  25. 25

    How to enable GZIP in my tomcat server having Https/ssl

  26. 26

    I can not connect to https waitress wsgi server

  27. 27

    I can not connect to https waitress wsgi server

  28. 28

    How can I manage and deploy snap packages without using the official Snap store from Canonical?

  29. 29

    How can I manage and deploy snap packages without using the official Snap store from Canonical?

HotTag

Archive