1

I am working on 2 servers and .htaccess file working on 1 server but not working on second server.

.htaccess file

RewriteEngine On
RewriteRule ^socket.io/(.*)$ ws://example.com:3000/socket.io/?$1  [P,QSA,L]

I am working on socket, so i dont want to show :port in url, so i just redirect url to port within htaccess

Url examples server 1,

ws://example.com/socket.io/etc Redirect ON ws://example.com:3000/socket.io/etc (working)

http://example.com/socket.io/etc Redirect ON ws://example.com:3000/socket.io/etc (working)

But on server 2, same code on different domain return "Internal Server Error"

I dont want to change my code, because it is my backup server, so i want to run same code, but what i am missing? Is there any apache extension required or what i am missing?

Faisal Abbas
  • 71
  • 1
  • 6
  • If you get "Internal server error", there should be an entry in apache error log with more info – Dusan Bajic Apr 04 '20 at 21:59
  • Error in Apache log: AH01144: No protocol handler was valid for the URL /socket.io/ (scheme 'ws'). If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule. – Faisal Abbas Apr 05 '20 at 10:27
  • Looks like you need to [enable mod_proxy_wstunnel](https://stackoverflow.com/questions/27526281/websockets-and-apache-proxy-how-to-configure-mod-proxy-wstunnel#27534443) – Dusan Bajic Apr 05 '20 at 12:32
  • Problem solved, Here: https://stackoverflow.com/a/53523424/11959017 Thanks – Faisal Abbas Apr 05 '20 at 16:26

0 Answers0