[Feature] HTTPS and CA Certificates#65
Open
cprbucat2 wants to merge 7 commits into
Open
Conversation
-Installed user CA cerificates into the production Docker image -Generated CA certificates for development -Added HTTPS to Go server
Collaborator
|
Might need to do |
Delete accidental duplicated Dockerfile Remove unneccessary expose port line
Owner
Author
To pass Go CI / lint check
Signed-off-by: Aidan Hoover <96591790+cprbucat2@users.noreply.github.com>
bobpaw
requested changes
Aug 4, 2023
|
|
||
| func redirect(w http.ResponseWriter, req *http.Request) { | ||
| log.Print(req.Host) | ||
| req.URL.Host = req.Host[:len(req.Host)-3] + "443" |
Collaborator
There was a problem hiding this comment.
This line needs a comment to explain what it's doing. Also maybe we should not do it by length because what if somebody decides they want to do it on port 80 and now this fucks up everything by removing the colon.
| func main() { | ||
| // redirect every http request to https | ||
| go func() { | ||
| err := http.ListenAndServe(":8080", http.HandlerFunc(redirect)) |
Collaborator
There was a problem hiding this comment.
Let's change the ports to 80
| router.POST("/api/submit", postUserSubmission) | ||
|
|
||
| if err := router.Run("0.0.0.0:8080"); err != nil { | ||
| if err := router.RunTLS("0.0.0.0:8443", "/etc/ssl/certs/cert.pem", "/etc/ssl/certs/key.pem"); err != nil { |
Collaborator
There was a problem hiding this comment.
Lets change it to just 443 and rewrite it to 8443 in the docker compose file
| target: server | ||
| tty: true # Get colorized Gin output. | ||
| ports: | ||
| - 8443:8443 |
Collaborator
There was a problem hiding this comment.
Let's make it 80 and 443 in the production docker compose file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Old behavior
Cannot have authentication without HTTPS.
New behavior
Additional info (related issues, images, etc.)
Closes #62