Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change snippet url to display current host #159

Merged
merged 7 commits into from
Jul 20, 2021
Merged

Conversation

wvffle
Copy link
Contributor

@wvffle wvffle commented Jun 25, 2021

Closes #98

@JuniorJPDJ
Copy link
Contributor

Is site.domain used anywhere beyond that?
It probably should be removed entirely from config.

@wvffle
Copy link
Contributor Author

wvffle commented Jun 25, 2021

It is in a few other templates and in .po files, though @milesmcc, should I replace them?

@JuniorJPDJ
Copy link
Contributor

I just searched for it and it will be hard to replace occurrences in e-mail templates.
IMO It would be cool to remove those which are on-page tho.

@JuniorJPDJ
Copy link
Contributor

This is probably also must-have:

"{{protocol}}://{{request.site.domain|default:request.META.HTTP_HOST}}{{endpoint}}",

@wvffle
Copy link
Contributor Author

wvffle commented Jun 26, 2021

hahahha, I did git commit -m "Remove `hostname` command" and it put my hostname :D

@JuniorJPDJ
Copy link
Contributor

JuniorJPDJ commented Jun 26, 2021

Are you sure that get_host will work in email templates?
In which context are those sent?

@wvffle
Copy link
Contributor Author

wvffle commented Jun 26, 2021

request should be in the context: https://github.com/pennersr/django-allauth/blob/353386216b79f16709e97bb487c0bbbba2bc0c71/allauth/account/forms.py#L556

at least in theory. I do not have the opportunity to test emails.

@CasperVerswijvelt
Copy link
Contributor

CasperVerswijvelt commented Jun 26, 2021

@wvffle You can test if email content is correct by checking shynet logs. Mails are also outputted there

@wvffle
Copy link
Contributor Author

wvffle commented Jun 27, 2021

Works well.

image

@JuniorJPDJ
Copy link
Contributor

Supercool then :D

@milesmcc
Copy link
Owner

Well done.

@milesmcc milesmcc merged commit 31cb616 into milesmcc:master Jul 20, 2021
@wvffle wvffle deleted the fix-98 branch July 20, 2021 08:35
@Henridv
Copy link

Henridv commented Sep 14, 2021

@wvffle

How do I make sure the hostname is correct when running Shynet using Docker Compose?

When using the edge image from Docker Hub request.get_host seems to return 127.0.0.1.

For now I reverted back to using version 0.10.0.

@JuniorJPDJ
Copy link
Contributor

You quacked up something badly. Are you accessing it using http://127.0.0.1?
It should just return host from client's request.

@Henridv
Copy link

Henridv commented Sep 14, 2021

No, I'm accessing it from a regular domain.

If I go to the Manage tab to get the script code it also says 127.0.0.1.

I'm running the container using docker compose, DNS is managed by Cloudflare and reverse proxy is nginx.

@JuniorJPDJ
Copy link
Contributor

so this is probably misconfigured reverse proxy
try tcpdumping requests coming to shynet container

@CasperVerswijvelt
Copy link
Contributor

@Henridv I'm also using Docker Compose, nginx as reverse proxy and cloudflare as DNS, and it works correctly for me.

This is my reverse proxy setup:

server {

        server_name analytics.casperverswijvelt.be;

        include /etc/nginx/snippets/listen-ssl-cloudflare.conf;
        include /etc/nginx/snippets/cloudflare-allow.conf;

        location / {
                proxy_pass http://localhost:9595;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_hide_header 'x-frame-options';
                add_header X-Frame-Options ALLOWALL;
        }
}

@Henridv
Copy link

Henridv commented Sep 15, 2021

Thanks @CasperVerswijvelt

This is the line I needed to add:

                proxy_set_header Host $host;

@milesmcc
Copy link
Owner

Great, glad this is fixed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple hosts using same instance
5 participants