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

Get Full URL issue #208

Open
binhvq opened this issue Nov 28, 2024 · 2 comments
Open

Get Full URL issue #208

binhvq opened this issue Nov 28, 2024 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@binhvq
Copy link

binhvq commented Nov 28, 2024

I want to retrieve the domain and path of requests, but I'm unable to do so. When attempting to get the full URL, the result only includes the path without the netloc or scheme.

I would like a solution that allows me to retrieve the complete URL, including the scheme, netloc, and path.

I've explored other methods to extract the complete URL, but none have successfully provided all the components (scheme, netloc, and path).

Currently, the issue is that only the path is returned, while the netloc and scheme are missing. This limits the functionality I need.

Request: http://domain1.com:8000/test-url
req.get_full_url
Result: /test-url

@cirospaciari cirospaciari self-assigned this Nov 28, 2024
@cirospaciari cirospaciari added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 28, 2024
@cirospaciari
Copy link
Owner

get_full_url respect the same api as uWebSockets will take a look in better names and usability for this, this weekend will have more updates :)

@ArthoPacini
Copy link

A workaround here is to put your process behind a proxy like Caddy, and then call Caddy to header_up the full url.

For example, if your socketi.fy process is running on port 5001, and your Caddy server is listening on port 7000:

:7000 {
    handle /* {
        reverse_proxy 127.0.0.1:5001 {
            header_up X-Full-Url {http.request.uri}
        }
    }
}

Then you can find and extract the full uri from the request header.

You may also pass

header_up X-Request-Method {method}
header_up X-Request-Path {path}

to get method and path if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants