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

A sample nginx configuration #6

Open
erdihu opened this issue Oct 27, 2019 · 2 comments
Open

A sample nginx configuration #6

erdihu opened this issue Oct 27, 2019 · 2 comments

Comments

@erdihu
Copy link

erdihu commented Oct 27, 2019

I know this is not a real issue but it might be good to include the necessary configurations to setup a reverse proxy. The following code snippet can be great help to others since the application requires some headers to be set and most browsers give mixed content error if the headers are not in place.

  location ^~ / {
  proxy_pass http://yourdomain.com:3000/;
  proxy_buffering off;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  }

Shortly, at least the following headers should be set:

  • Host
  • X-Forwarded-Proto

The other's are not required to make CSS and JS files load correctly, however can be useful for other purposes.

One possible solution to remove the protocol dependency is to call the styles and scripts by omitting the protocol and letting the browser handling it: //domain.com/stlye.css
I tried to find where this is being set but couldn't navigate myself safely in Haskell code.

@jonschoning
Copy link
Owner

I don't want to include a full proxy profile because different users have different needs, but i think your point about including some notes about X-Forwarded-Proto is a good one, i can add that to the readme

@matthewblott
Copy link

I know this is not a real issue but it might be good to include the necessary configurations to setup a reverse proxy. The following code snippet can be great help to others since the application requires some headers to be set and most browsers give mixed content error if the headers are not in place.

  location ^~ / {
  proxy_pass http://yourdomain.com:3000/;
  proxy_buffering off;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  }

Shortly, at least the following headers should be set:

  • Host
  • X-Forwarded-Proto

The other's are not required to make CSS and JS files load correctly, however can be useful for other purposes.

One possible solution to remove the protocol dependency is to call the styles and scripts by omitting the protocol and letting the browser handling it: //domain.com/stlye.css I tried to find where this is being set but couldn't navigate myself safely in Haskell code.

Thanks, this helped me out a tonne :-)

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

3 participants