Skip to content

Commit

Permalink
disabled absolute URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
jirikapoun committed Oct 9, 2017
1 parent 129f0c6 commit a36056a
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions public-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -718,21 +718,7 @@ function df_is_logged_in(){
}

function df_absolute_url($url){
if ( !$url ) return $_SERVER['HOST_URI'];
else if ( $url{0} == '/' ){
return $_SERVER['HOST_URI'].$url;
} else if ( preg_match('/http(s)?:\/\//', $url) ){
return $url;
} else {
$host_uri = $_SERVER['HOST_URI'];
$site_url = DATAFACE_SITE_URL;
if ( $site_url ) {
if ($site_url{0} == '/' ) $host_uri = $host_uri.$site_url;
else $host_uri = $host_uri.'/'.$site_url;
}

return $host_uri.'/'.$url;
}
return $url;
}


Expand Down

4 comments on commit a36056a

@shannah
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This essentially breaks the df_absolute_url function. What problem are you trying to fix?

@jirikapoun
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I started to deploy my Xataface applications behind a reverse proxy and absolute URIs do not function properly in that case. Instead of URI like http://myapp.com/index.php?-table=..., it gives me something like http://myapp:8051/index.php?-table=.... Instead of spending time trying to solve the issue, I decided to disable absolute URIs completely, because I personally don't consider them necessary. However, I understand you can have reasons for using them, therefore I haven't posted a pull request regarding this and keep this commit in a separate branch.

Best regards,
Jiri Kapoun

@shannah
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break a few things in Xataface (e.g. forgot password emails will now send relative URLs which aren't tremendously helpful to the user - and some nuanced authentication features appear to depend on this function working reliably.

@jirikapoun
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my case, users are authenticated by NGINX using HTTP Basic Auth and LDAP lookup, therefore I don't use any authentication features of Xataface. Still, it's good to be aware of that. Thanks for the notice.

Regards,
Jiri Kapoun

Please sign in to comment.