Skip to content

(non-default) port missing with absolute URLs (e.g. in schema URL) #5416

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

Closed
blueyed opened this issue Sep 12, 2017 · 4 comments
Closed

(non-default) port missing with absolute URLs (e.g. in schema URL) #5416

blueyed opened this issue Sep 12, 2017 · 4 comments

Comments

@blueyed
Copy link
Contributor

blueyed commented Sep 12, 2017

request.build_absolute_uri() is used in e.g. SchemaGenerator.get_schema(), but this does not include the port being used.

This is bad when using e.g. the coreapi-cli client against a local runserver instance, where links cannot be resolved then.

While the port could be included on Django's side maybe, it might be better to use get_raw_uri() instead?!

@rpkilby
Copy link
Member

rpkilby commented Sep 12, 2017

Hi @blueyed. Off the cuff, this doesn't sound correct. Both request.build_absolute_uri() and request.get_raw_uri() ultimately make calls to request._get_raw_host(), which is what is used to return the HOST+PORT.

@blueyed
Copy link
Contributor Author

blueyed commented Sep 12, 2017

@rpkilby
You're right - so it would likely not help to use get_raw_uri() then, and I need to investigate if and why _get_raw_host() does not work.

@rpkilby
Copy link
Member

rpkilby commented Sep 12, 2017

Sounds good. I'm going to close this for now, since this sounds like a configuration issue.

@rpkilby rpkilby closed this as completed Sep 12, 2017
@blueyed
Copy link
Contributor Author

blueyed commented Sep 13, 2017

It turned out to be a bug in coreapi-cli when using --debug.. core-api/coreapi-cli#22

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

No branches or pull requests

2 participants