Built-in web server with hosts hack

I have a project called iznik-client.  I've configured the port number to 3000 and I can access it on http://localhost:3000/iznik-client/index.html.  

I'm trying to use the hack to the hosts file to access it without the project name in the path, because the project code assumes it's installed at the top-level of a domain.

So I've added this to my hosts file:

127.0.0.1 iznik-client

But when I then access http://iznik-client:3000/index.html, I get a 404 error returned from the built-in web server (I can see it's the PhpStorm one).

What have I done wrong?

0
10 comments

Hi there,

Looks like you did it correct so far -- worked for me when I've tried it (about year ago or so). But then -- I've used standard 63342 port only.

P.S. See if enabling option to allow external connections on that port will do the job (I believe it's what may be missing here).

0
Avatar
Permanently deleted user

Yes, I have it set to allow external connections.

I don't think the port can be the problem, as the error I'm getting shows that it is connecting to the PhpStorm server.  I've also checked that if I change the port number it no longer works on localhost (just to exclude it connecting to some different port number when it's working).

0

It should be working from what I see:

https://youtrack.jetbrains.com/issue/WEB-25618

 

Can you post some screenshots with relevant settings -- maybe it will show some missing nuance.

0
Avatar
Permanently deleted user

Here are the settings.  Anything else?

I saw a suggestion somewhere that I needed an in place deployment set up, but I tried that, and it didn't seem to help (though I may not have done it right).  In other places it didn't mention that, so I'm not sure if it is needed.

0

This part is fine.

I want to double check the project name / project folder name / URL.

Basically -- please show the Project View (top line mainly -- full content) and the actual URL.

 

I've just tested it here ... and it worked (but I have some nuances .. so it took extra step/change)

 

P.S. Deployment entry is needed for opening URLs from IDE. Maybe for debugging as well. If you type them manually in browser -- no real need for that.

1
Avatar
Permanently deleted user

This?

 

0

Yes.

I assume that you have "index.html" file in "iznik-client" folder (which is a root folder)?

It works fine here.

My issue was that my project is located in "_idetest" folder .. but I gave it "IDE-Test" name .. and tried to access it via "idetest:3000" domain -- that shows 404. But if I access it via "_idetest:3000" (folder name) or "ide-test:3000" (actual project name) it works fine.

For me it picks up "index.html" when no file is specified. If file is absent -- the it serves "index.php"

 

0
Avatar
Permanently deleted user

I don't have an index.html in the top-level of the project; it's built via webpack into dist/index.html.  But if I go to http://iznik-client:3000/dist/index.html then I also get 404.

Sorry, should have mentioned that.

0

Your "dist" folder is marked as excluded -- maybe that's the reason?

Please create some simple "index.html" and place in project root -- does it work?

 

EDIT: Does not look like exclusion makes the difference here.

No better ideas. I may only suggest to:

1) check idea.log (Help | Show Log in XX) for possible hints

2) See what JetBrains support team have to say about it

3) Use "Submit a request" link on the top of the page to file a Support ticket

0
Avatar
Permanently deleted user

Ok, I'll try those.  Thanks for taking the time to experiment for me.

0

Please sign in to leave a comment.