Wrong redirect after login in discourse subfolder


(Abhigyan Khaund) #1

I have my Discourse set up in mydomain[dot]com/discourse in a subfolder. Everything is working fine and I had setup everything according to the steps in Subfolder support with Docker.

However I am having an issue, whenever a user logins or signups, at mydomain[dot]com/discourse he is redirected to mydomain.com/discoursediscourse/discourse instead of mydomain[dot]com/discourse/discourse.

You can see the continuation in the URL. I cannot find a cause as all other URLs are properly working without with the subfolder any errors.

env of my app.yml:

env:
  LANG: en_US.UTF-8
  DISCOURSE_HOSTNAME: 'domainname.com'
  DISCOURSE_RELATIVE_URL_ROOT: /discourse

part of my run in app.yml

- exec:
  cd: $home
  cmd:
    - mkdir -p public/discourse
    - cd public/discourse && ln -s ../uploads && ln -s ../backups
    - rm public/uploads
    - rm public/backups
- replace:
  global: true
  filename: /etc/nginx/conf.d/discourse.conf
  from: proxy_pass http://discourse;
  to: |
    rewrite ^/(.*)$ /discourse/$1 break;
    proxy_pass http://discourse;
- replace:
  filename: /etc/nginx/conf.d/discourse.conf
  from: etag off;
  to: |
    etag off;
    location /discourse {
      rewrite ^/discourse/?(.*)$ /$1;
    }

I have also set long polling base url: /discourse/.
Note: The code is app.yml is properly indented and working, I am just unable to indent it in this post.


(Neil Lalonde) #2

I assume that stray backtick isn’t in your app.yml file?

You can remove those lines.

Is that a mistake, or do you really want two subfolders?

I don’t see anything that should be causing that redirect only on login and signup…


(Abhigyan Khaund) #3

Yes that isn’t on my app.yml.

The ideal redirect should be mydomain.com/discourse/, but mydomain.com/discourse/discourse/ also redirects to the first mentioned url, so that isn’t a problem.
The problem is the redirection to mydomain.com/discoursediscourse/discourse/, which is only during login and signup.


(Neil Lalonde) #4

Is it using SSO or 3rd party auth like Google?


Subfolder support with Docker
(Abhigyan Khaund) #5

It is using default discourse auth, i.e. using username and password. No third party auth is used.


(Abhigyan Khaund) #6

I have found that going to mydomain.com/discourse/login redirects me to mydomain.com/discoursediscourse/discourse/ if I am logged in already. I think the issue is in the redirect caused by the login page.


(Neil Lalonde) #7

Hmm… Can you reproduce on my test site? Neil Tests The Things


(Abhigyan Khaund) #8

Nope. I can’t. Seems to be working properly on your site.
You can check on the site that I am using Discourse


(Neil Lalonde) #9

Very very weird… I can see the multiple "discourse"es being added to the path one at a time, from javascript I assume.

http://sntc.iitmandi.ac.in/discourse
http://sntc.iitmandi.ac.in/discoursediscourse
http://sntc.iitmandi.ac.in/discoursediscourse/discourse

I don’t know what to look at… Do you have any plugins installed? Any custom stuff at all? Any deviation from the normal subfolder setup? I have no idea.


(Abhigyan Khaund) #10

No none at all. I have just freshly installed discourse following the subfolder how-to.


(Abhigyan Khaund) #11

Anything about how I can fix this?


(Abhigyan Khaund) #12

Anything about how I can fix this?


(Neil Lalonde) #13

I have no ideas about what could be wrong. You say it was setup following our instructions and there are no plugins or customizations of any kind, so… it should work fine. Sorry, you’ll have to dig into it more to find out what’s different from the standard. Try upgrading to the latest version again.