# Mod Rewrite - Node.js

This topic is 1647 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all,

I struggle with mod_rewrite rules for Node.js.

I know that the better way to do it seems to be working with a different kind of proxying, but right now that seems to be too much trouble to go through.

I will probably do that later, though.

What I was trying to do is get all the requests to a [BASE_URL]/node forwarded to the node.js server.

That server is running on localhost:8888 ... and it currently returns the same string no matter what kind of request goes in.

Now the problem is a complaint: "Attempt to serve directory: proxy:http://127.0.0.1:8888/" (Or something like "missing file" if it is not a directory).

I want all those requests to be handled by the node.js server, though. Why does it even try to find files in the fs?

The setup: Confixx/Apache, Drupal, Node.js on port 8888 ...

The rewrite rules in the .htaccess file of the /node directory of the html base directory:

  RewriteRule ^(.*)$http://127.0.0.1:8888/$1 [P,L]
RewriteRule ^\$ http://127.0.0.1:8888/ [P,L]



Might it be that mod_proxy (that is a thing, right?) isn't installed?

Is the problem solved differently in general?

An article mentions the creation of a symlink to the node directory ... I didn't get what that was about. Is that the problem? Do I need one of those? Again, I want all those requests to go directly to the node.js server, no matter what.

Or is something wrong with the subdirectory?  Some documentation went on and on about rewrite rules on a subdirectory basis :-?

I have looked through some documentation (Mod Rewrite stuff), StackExchange ... Google search ... but I don't really know what I should be looking for and how to think about the task at hand.

Thanks for reading :-) ... any questions or ideas?

##### Share on other sites

Hope it is ok to bump this.

I really don't make any progress here. Reading about symlinks and htaccess files doesn't really help when you don't know wht you are looking for.

Again, the problem is:

"Attempt to serve directory: proxy:http://127.0.0.1:8888/"

I don't want to redirect to a directory, though. I want the requests to go to the node.js server.