Setup wizard emoji wrong in subfolder install

subfolder

(A. A.) #1

Discourse is individually installed in a server which has ‘discourse.domain.com’ assined. The aim is to be able to use discourse ‘www.domain.com/discourse’. I followed the instructions on the github page; installed and re-configured nginx configuration.

When I visit ‘domain.com/discourse’ I get the errors saying ‘domain.com/assets/{js-file}.js is not loaded.’

Here is my configurations:

location ~ /discourse/(.*)$ {
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $host;
            proxy_redirect off;
            proxy_set_header X-Real-IP  $remote_addr;
            proxy_pass  http://{ip of discourse server}:80/$1;
    }

container/app.yml is not reconfigured after installation.

When I hit domain.com/discourse I get this log from nginx access logs:

[03/Jul/2018:06:35:34 +0000] "domain.com" xx.xx.xx.xxx "GET / HTTP/1.0" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Firefox/60.0" "categories/index" 200 29332 "-" 0.044 0.043 "-"

There is nothing in nginx error logs.

Can you point out the mistake I am not able to see here? How can I configure the assets so they can be loaded correctly?
Why the assets are not loaded as ‘domain.com/discourse/assets/…’ ?

Update: the servers are behind cloudfire that is why I ended up using ip address in nginx config rather that domain name.


(Christoph) #2

I guess what you’re trying to do is a subfolder install? The instructions for that are here:

But note that it is absolutely not the recommended way of running discourse (search this forum for “subfolder install”.


(A. A.) #3

@tophee is it still considered ‘subfolder install’ when discourse is in different server and want to use it behind reverse proxy?
I will give it a shot and update the topic.


(Cameron:D) #4

Yes, because Discourse uses absolute URLs everywhere so you’ll need to set it up as a subfolder.


(Flaviu) #5

Dear Cameron,

There are some images which are not loading properly with discourse correctly installed in a subfolder on another server behind a reverse proxy. Please see the image bellow!

the problem is that the missing pictures have the wrong image path. instead of having thery are for the logo I could manage to change as these images are configurable from admin, but what about this emoji images which are not loading correctly?

so instead of being www.example.com/forum/img/img.png they are www.example.com/img/img.png

all the links, and everything else work as expected

Some other pictures are working, so I don’t suspect a miss configuration, but a bug.

Do you have any idea how I can resolve this?

Thank you
F


(Sam Saffron) #6

@tophee is correct this is a subfolder install and you should follow the subfolder guide.

Given the questions here I would recommend avoiding subfolder, it requires quite a lot of technical skills to get a proxy working just right. I would recommend just going with our vanilla setup.


(Flaviu) #7

Dear Sam, thank you for your fast answer.

I followed the guide and everything work correct but some pictures.

as you can see in the uploaded picture the Discourse logo has the corect path,
url(’/community/images/wizard/discourse.png’)

As I sadi, some picture shows correctly, some are not, how can an incorect setup can determine this type of behavior? In a situation in which none of the pictures show corectly I could say that something is wrong, but this is not the case

here are some pictures rendered corectly

and here are two from the same instaltion which are not correct rendered

this one is from a recover password page

missing%20pictures%20Discourse%20-%203

this one is from the initial registration process in which you can see above that other images are perfectly fine

and this is the html code for the above images which are not rendering

So, @sam, please tell me what I am doing wrong. I can give you the website URL if you want to see for yourself.

Thank you,


(Sam Saffron) #8

You know, there is a reason we do not even offer subfolder setups to business and standard tier, this is a value add to our enterprise tier.

I am not sure what you are doing wrong and it would take me a fair amount of time to debug it.


(Flaviu) #9

Dear Sam,

Well, now I understand your perspective and I agree with your point of view.

I am sorry you could not give me some hints

If you say that this is not a bug, then what I need to do is to try to debug myself what is wrong.


(Cameron:D) #10

If they work through the rest of the site it could just be that the setup hard-codes the image paths.


(Flaviu) #11

I know, but this is not something that you can configure anywhere in the setup process. That’s why I was suggesting that this is a bug


(Andrew Schleifer) #12

The subfolder guide tells you how to configure it.


(Flaviu) #13

Dear @schleifer,

I have already did that. What I was saying is that there is no way in which you can configure a different path for center images and a different path for other images.

If I wouldn’t had everything configured correctly, none of the links/uploads/some avatars would work.

That’s why I am saying that this looks like a bug, as some pictures have correct path and other have not.

If you look at my above post you could see more examples with working and not working pictures from the same setup.

I have a very good understanding how http protocols and reverse proxy works and I don’t think the issue is in my configuration but in the way Discourse render some of the pictures.

Unfortunately I have no experience with rails application to try to figure out in what part of the code it may be the problem. That’s why I asked for some help from the Discourse community. But unfortunately, there are other interests with a subfolder setup than the well-being of the users trying to do this setup.


(Jeff Atwood) #14

@neil can you take a quick look at those wizard code paths and see if they’d be affected by subfolder?


(Neil Lalonde) #15

I’m upgrading a DO subfolder site now, so I’ll check the wizard once that’s done.


(Andrew Schleifer) #16

I’ve just gone through a subfolder setup on a brand new installation. Emoji icons in the wizard look fine.

image

So, if you follow the directions in the linked topic, it works. If you’ve setup things differently, then you’ll have to give a lot more detail about how you setup the reverse proxy. Otherwise everyone is just randomly guessing what the problem is.


(Neil Lalonde) #17

Hmm, works for me too but the image url’s are wrong. Looks like a bug:


(Flaviu) #18

Hello @neil ,

the reason images are loading for you is that somehow they are available also in the /images

http://gtmdiscourse.neillalonde.com/images/emoji/twitter/smile.png
as you can see the image is loading

I suspect that somehow you have another installation or a folder with the same images in the root of the website. But this should not be normal, as you may have another webserver with different images in that location


(Jeff Atwood) #19

OK if it’s a bug let’s fix it! Certainly looks that way from your screenshot.


(Flaviu) #20

THANK YOU @codinghorror @neil @schleifer

That’s really appreciated.

Is there a way in which I can help you track down all the images, or you have a smarter way than doing it manually?