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

Be able to test /login/sso/redirect in Complement #17986

Merged
merged 6 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/complement/conf/workers-shared-extra.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#}

## Server ##
public_baseurl: http://127.0.0.1:8008/
anoadragon453 marked this conversation as resolved.
Show resolved Hide resolved
report_stats: False
trusted_key_servers: []
enable_registration: true
Expand Down
2 changes: 1 addition & 1 deletion docker/conf-workers/nginx.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ server {
{% endif %}
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_set_header Host $host:$server_port;
anoadragon453 marked this conversation as resolved.
Show resolved Hide resolved
}
}
2 changes: 1 addition & 1 deletion scripts-dev/complement.sh
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ if [ -z "$skip_docker_build" ]; then

# Build the unified Complement image (from the worker Synapse image we just built).
echo_if_github "::group::Build Docker image: complement/Dockerfile"
$CONTAINER_RUNTIME build -t complement-synapse \
$CONTAINER_RUNTIME build -t ghcr.io/element-hq/synapse/complement-synapse \
-f "docker/complement/Dockerfile" "docker/complement"
echo_if_github "::endgroup::"

Expand Down
1 change: 1 addition & 0 deletions synapse/config/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,5 +360,6 @@ def setup_logging(
"Licensed under the AGPL 3.0 license. Website: https://github.com/element-hq/synapse"
)
logging.info("Server hostname: %s", config.server.server_name)
logging.info("Public Base URL: %s", config.server.public_baseurl)
anoadragon453 marked this conversation as resolved.
Show resolved Hide resolved
logging.info("Instance name: %s", hs.get_instance_name())
logging.info("Twisted reactor: %s", type(reactor).__name__)
7 changes: 7 additions & 0 deletions synapse/http/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@
# [This file includes modifications made by New Vector Limited]
#
#
import re
from typing import Union

from twisted.internet import address, task
from twisted.web.client import FileBodyProducer
from twisted.web.iweb import IRequest

from synapse.api.errors import SynapseError

import logging

logger = logging.getLogger(__name__)

Check failure on line 32 in synapse/http/__init__.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (I001)

synapse/http/__init__.py:21:1: I001 Import block is un-sorted or un-formatted


class RequestTimedOutError(SynapseError):
"""Exception representing timeout of an outbound request"""
Expand Down Expand Up @@ -72,13 +76,16 @@
def _get_requested_host(request: IRequest) -> bytes:
hostname = request.getHeader(b"host")
if hostname:
logger.info("asdf _get_requested_host hostname from Host header %s", hostname)
return hostname

# no Host header, use the address/port that the request arrived on
host: Union[address.IPv4Address, address.IPv6Address] = request.getHost()

hostname = host.host.encode("ascii")

logger.info("asdf _get_requested_host %s %s", hostname, host.port)

if request.isSecure() and host.port == 443:
# default port for https
return hostname
Expand Down
5 changes: 5 additions & 0 deletions synapse/rest/client/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,11 @@ async def on_GET(
# get our cookies back.
requested_uri = get_request_uri(request)
baseurl_bytes = self._public_baseurl.encode("utf-8")
logger.info(
"asdf _public_baseurl=%s requested_uri=%s",
self._public_baseurl,
requested_uri.decode("utf-8"),
)
if not requested_uri.startswith(baseurl_bytes):
# swap out the incorrect base URL for the right one.
#
Expand Down
Loading