1

I have an Apache/2.4.6 installation working as a reverse proxy for some applications. Now I have to configure another one. HTTP proxying is working great, but in some sections of the webpage, the client tries to start a websocket connection.

The problem is that the url is partially shared:

HTTP request: http://domain/context/[whatever]

WS request: ws://domain/context/specific-text?param1&param2

Cannot use If (checking the protocol) as ProxyPass cannot go inside <If>.

Tried setting:

<Location /context/specific-text> ProxyPass ws://internal.domain/context/specific-text 

Before

<Location /context/> ProxyPass http://internal.domain/context/ 

But doesn't work, guess because of the (non existant) trailing slash.

More data:

  • The socket is complaining about not liking a "200" code, Apache is not returning a ws conection but, to some point, the proxying is being made.
  • Tried with and without <Location>
  • Thought of rewriting specific-text to specific-text/ but I don't like to manipulate things I don't manage. The application is a paid product, can't ask if it would harm anything. Well, I could, I'd just wouldn't expect any answer.

1 Answer 1

0

What works for me is this ProxyPass config snippet:

ProxyPass /specific wss://0.0.0.0:4000/specific ProxyPassReverse /specific wss://0.0.0.0:4000/specific ProxyPass / https://0.0.0.0:4000/ ProxyPassReverse / https://0.0.0.0:4000/ 

The documentation says:

Ordering ProxyPass Directives

The configured ProxyPass and ProxyPassMatch rules are checked in the order of configuration. The first rule that matches wins.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.