carlreinecken / piqchat-inbox-server

Selfhost your own piqchat inbox server
https://piqchat.net
ISC License
3 stars 1 forks source link

configure the outward facing domain of the server #5

Open willscott opened 7 months ago

willscott commented 7 months ago

it's not uncommon to want to run a service like this bound to localhost, and then have something like an nginx reverse proxy in front of it terminating ssl and routing inbound requests to the service.

right now, this leads to broken invites, where the server generated invite has it's own conception of where it is "http://127.0.0.1:8080" rather than the externally facing domain that users should be sending their traffic to. it would be good to provide a config hook to tell the server where that is.

willscott commented 7 months ago

this is due to https://github.com/carlreinecken/piqchat-inbox-server/blob/master/src/contact-exchange/routes/create-contact-exchange.js#L14

carlreinecken commented 7 months ago

Thanks for the feedback! I know that someone else also had this problem and solved it by setting the header Host option proxy_set_header in the nginx config:

...

location / {
  ...

  proxy_set_header X-Forwarded-For $remote_addr;
  proxy_set_header Host $host;

  ...

But I guess if more run into this problem, an env variable is maybe a simpler solution.