3

during development, I'd like to use an already existing test server, this server uses apache, so I basically used mod_proxy to proxy it to a subdirectory of my server, let's say http://myserver/myreactapp/ Problem is, I didnt find a way to tell the development server that the js shouldnt be in

<script type="text/javascript" src="/static/js/bundle.js"></script></body>

but in

<script type="text/javascript" src="/myreactapp/static/js/bundle.js"></script></body>

or more logically, in a relative path. I found this option for the build, but not the development server. what is a good way of achieving that ?

3
  • If you use nginx, you can use alias location /static/ { alias /myreactapp/static/; }. I do not know is anything like this for apache. Commented Feb 21, 2018 at 9:35
  • I suppose there's a way to do that with apache, I'll check mod_proxy's documentation Commented Feb 21, 2018 at 9:44
  • I added the answer for apache. Commented Feb 21, 2018 at 12:43

1 Answer 1

2

If you use nginx, you can use alias like this:

location /static/ {
  alias /myreactapp/static/;
}

If you use apache, the alias syntax is:

Alias "/static" "/myreactapp/static"
Sign up to request clarification or add additional context in comments.

1 Comment

It works, but I'll have to find another solution soon, because my goal is to have more than one app proxied, so more than one static directory ^^

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.