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

Skip webserver port detection if running behind a reverse proxy #209

Closed
wants to merge 1 commit into from
Closed

Conversation

Httqm
Copy link

@Httqm Httqm commented Oct 21, 2014

When running Shaarli behind a reverse proxy, Ajax-based functions (such as autocomplete of shaarlink tags) stops working.

  • BEFORE installing the reverse proxy : the webserver is accessible from the Internet directly on port 80. This port is also detected by the "serverUrl" function. Ajax requests are sent there for autocomplete of tags : http://shaarli.domain.tld/?ws=tags&term=
  • AFTER installing the reverse proxy : the webserver is listening on port 8080 (or any other port : this is some webserver-internal stuff), and it's listening to the reverse proxy exclusively. The reverse proxy itself is listening on port 80. It such case, the "serverUrl" function detects "8080" as the server port, and Ajax queries are sent to http://shaarli.domain.tld:8080/?ws=tags&term= , where nobody's publicly listening. Then no more autocompletes :-(

The change I've made tries to circumvent this : if no reverse proxy port is declared, let's keep the previous behaviour (autodetect the server port). Otherwise, use the provided reverse proxy port (mostly 80) to build the destination addresses :

http://shaarli.domain.tld:/?ws=tags&term=

@nodiscc
Copy link

nodiscc commented Oct 21, 2014

Related #101

@Httqm
Copy link
Author

Httqm commented Oct 22, 2014

Alright ;-)
Do I have some further actions to make, now ?

@nodiscc
Copy link

nodiscc commented Oct 22, 2014

Hi @Httqm , thanks for the pull request! I don't have a reverse proxy at hand right now, so unfortunately I can't test this. I will give it a try sometime soon and merge it in https://github.com/shaarli/Shaarli/ if it works properly.

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.

2 participants