ibgib
I’m currently in the process of deploying ibgib, and I just finished configuring my DNS
.
Now I’m trying to set up https redirection so that (http://)www.ibgib.com will automatically redirect to https://www.ibgib.com. What is the “proper” way to implement this?
I know of the force_ssl option in the endpoint configuration, which I’ve tried turning on (with hsts: true), however this does not seem to do the redirect. But this could be that I do not have my docker setup properly configured. Is setting this supposed to do the redirect? Or am I supposed to accomplish this another way, perhaps with nginx? And if nginx is the way to go, could I then completely remove the http config setting from my endpoint config? ![]()
Additional Background
I’m currently using distillery to produce a release and then docker (engine, compose, machine) with a “simple” setup of my release container + a postgres container deployed to aws ec2. My full-ish (foolish?
) ongoing deployment notes can be found in my deploy issue for anyone else looking to go elixir + docker + aws.
Trending in Questions
Other Trending Topics
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 26 to 17- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
persianturtle
I’m using Google App Engine Flex and the above is working fine for me.
HTTP traffic redirects to HTTPS nicely and my Elixir app is only configured for HTTP (since GCP manages my certificate and handles that outside of my app).
acropoiesis
Thanks @josevalim! Got it working!
josevalim
Set
:force_sslin your config/prod.exs and notconfig/releases.exs, as it is read at compile time. More recent Phoenix versions actually warn if you do this mistake.acrolink
Nginx.
acropoiesis
I’m running into the same issue with GCP. I have a simple Phoenix app running on App Engine, but it’s not redirecting to https. I’ve tried all recommendations above, but nothing has worked for me.
Here is what I currently have in my
config/releases.ex:When I run
curl -s -D- http://my-app.comI get a 200 and the html response back, and when I runcurl -s -D- https://my-app.com | grep -i Strictand get no output at all.Can anyone help?
polypush135
In the context of
localhostfordevnothing from above will allow me to redirect allhttprequests tohttps.What should I do? Is this just a bad idea? I feel crazy having this hard of a time trying figuring it out.
Edit: After some more digging and help from @NobbZ I found that I needed a combination of host, exclude and rewrite_on to make this work locally. Also leaving host as nil would cause 4000 to be used when redirecting to https.
nikody
I stumbled upon a similar problem with a Phoenix application deployed in AWS Elastic Beanstalk with a load balancer and the
force_ssl: [rewrite_on: [:x_forwarded_proto]setting fixed the too many redirects errors. However, as the Plug.SSL documentation mentions:I wanted to ask to be sure, but are there any security vulnerabilities in this case with an AWS LB? The AWS Classic Load Balancer documentations says:
So I assume the third case from the Plug.SSL docs (
your proxy sets the x-forwarded-proto and sends it to Plug) happens in this case, am I correct to assume that and that this setting should be fine from a security perspective here?ijunaidfarooq
Thanks it worked.
outlog
“it works for me”
can you check with curl
eg
curl -s -D- http://myapp.herokuapp.comshould output a 301 to the https
and
curl -s -D- https://myapp.herokuapp.com | grep -i Strictshould output
Strict-Transport-Security: max-age=31536000
ijunaidfarooq
It didnt work..
results are the same, nothing get force. both app. and https://app. working, any other clues?