Coder Social home page Coder Social logo

Comments (27)

Northernside avatar Northernside commented on May 20, 2024 1

oh my fucking god
...
idk what to say
😭

from accent.

simonprev avatar simonprev commented on May 20, 2024 1

Yeah FORCE_SSL is documented but not used in the codebase, that’s my bad 😄

from accent.

simonprev avatar simonprev commented on May 20, 2024

Hello! What’s your CANONICAL_URL in your env var? All the necessary config are documented here: https://github.com/mirego/accent?tab=readme-ov-file#production-setup

From what I can tell you will need CANONICAL_URL=https://translate.ebio.gg

from accent.

Northernside avatar Northernside commented on May 20, 2024

Hello there,
my CANONICAL_URL is set to https://translate.ebio.gg. This is my entire environment variables configuration:
image

Are all of the ones from https://github.com/mirego/accent?tab=readme-ov-file#production-setup fully required?

from accent.

simonprev avatar simonprev commented on May 20, 2024

I think your env var are not loaded correctly since the log should show the full URL here:

[info] Running Accent.Endpoint with Bandit 1.1.0 at 0.0.0.0:4000 (http)
[info] Access Accent.Endpoint at https://afdh9f20-asdoh.ngrok.io

If you are statring it with docker compose, the environment is not read from the .env file, it is declared directly in the yaml file. This could be improved in the documentation. A PR is welcome!

from accent.

RappyTV avatar RappyTV commented on May 20, 2024

Maybe also dont put https:// before the canonical url. That broke my instance

from accent.

Northernside avatar Northernside commented on May 20, 2024

I think your env var are not loaded correctly since the log should show the full URL here:

[info] Running Accent.Endpoint with Bandit 1.1.0 at 0.0.0.0:4000 (http)
[info] Access Accent.Endpoint at https://afdh9f20-asdoh.ngrok.io

If you are statring it with docker compose, the environment is not read from the .env file, it is declared directly in the yaml file. This could be improved in the documentation. A PR is welcome!

Am I doing something wrong again or not? I tried to port the vars from .env to the docker-compose.yml.

image image

from accent.

RappyTV avatar RappyTV commented on May 20, 2024

@Northernside you misspellt CANONICAL xd

from accent.

Northernside avatar Northernside commented on May 20, 2024
image

okay well, it does show me the correct url now, but it still redirects to localhost :p

from accent.

RappyTV avatar RappyTV commented on May 20, 2024

i don't think that this is the problem but it will solve a problem later. try to remove the https:// in the canonical url. that solved the problem for me

from accent.

Northernside avatar Northernside commented on May 20, 2024

Well, now it shows localhost:4000 again.
image

Strangely enough, I can access the website through the direct ip + port but not when using a domain proxied through Cloudflare and then through Nginx.

from accent.

RappyTV avatar RappyTV commented on May 20, 2024

Yes it shows that on my machine too

from accent.

RappyTV avatar RappyTV commented on May 20, 2024

But it works

from accent.

simonprev avatar simonprev commented on May 20, 2024

By removing the https:// the canonical is invalid so it does not enforce a URL 😄 That’s why it works.

from accent.

RappyTV avatar RappyTV commented on May 20, 2024

oh lmao. well if I didn't remove the https:// I would just get a too much redirects error

from accent.

RappyTV avatar RappyTV commented on May 20, 2024

turns out http:// works

from accent.

remi avatar remi commented on May 20, 2024

Yes indeed, because SSL is enforced if the canonical URI is using https.

https://github.com/mirego/accent/blob/master/config/runtime.exs#L23

from accent.

remi avatar remi commented on May 20, 2024

If you’re using nginx to handle the TLS stuff, the Elixir application should not be handling it too.

from accent.

remi avatar remi commented on May 20, 2024

However, if nginx is handling the TLS termination and passing the X-Forwarded-Proto to the Elixir application, CANONICAL_URL=https://… should work.

https://github.com/mirego/accent/blob/master/lib/accent/endpoint.ex#L50

from accent.

Northernside avatar Northernside commented on May 20, 2024

This is my Cloudflare:
image

it passes translate.ebio.gg to server X and server X is a Nginx server which then passes it to 127.0.0.1:4000, as seen here:
image

127.0.0.1:4000 is Accent and it's configuration is this:
image

cURL'ing both http and https:
image

Maybe this clarifies a bit more of my current issue/situation. Do you know any way on how I can prevent it from redirecting to localhost?

Changing the CANONICAL_URL from https://translate.ebio.gg to http://translate.ebio.gg does not change anything in terms of behaviour, as seen here again:
image

Also explicitly setting FORCE_SSL to false has no effect on this behaviour.

from accent.

RappyTV avatar RappyTV commented on May 20, 2024

then you also have to change the https:// to http:// in the canonical url as remi said

from accent.

Northernside avatar Northernside commented on May 20, 2024

then you also have to change the https:// to http:// in the canonical url as remi said

image Well.. 👀

from accent.

RappyTV avatar RappyTV commented on May 20, 2024

ah i'm dumb and i can't read

from accent.

Northernside avatar Northernside commented on May 20, 2024

dont worry!

from accent.

Northernside avatar Northernside commented on May 20, 2024

However, if nginx is handling the TLS termination and passing the X-Forwarded-Proto to the Elixir application, CANONICAL_URL=https://… should work.

https://github.com/mirego/accent/blob/master/lib/accent/endpoint.ex#L50

image

Tried that, nothing changed 👀

from accent.

Northernside avatar Northernside commented on May 20, 2024

Oh, funny thing: if I access https://translate.ebio.gg/ it returns me to https://localhost but if I access https://translate.ebio.gg/? (or any other query related input) it returns me to https://translate.ebio.gg/ AND serves the proper content. What? 😭

from accent.

Northernside avatar Northernside commented on May 20, 2024

Oh oops nevermind, it seems like it was just a silly cache on my side!

Thank you for all your help ❤️

from accent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.