I have virtual machine with laravel 5 + nginx + varnish on board.
varnish works on port 80, nginx on 8080.
When i go to admin panel:
admin.mysite.ru
it must redirect to admin.mysite.ru/user/login/ if user is not log in. It correct. But when this happend, it redirected to admin.mysite.ru:8080/user/login/, that's wrong.
Redirect code is simple: redirect()->guest('/user/login/');
Thats problem come after i installed varnish, so, i cant understand how to resolve this problem. Could you give some advice or solution? Thank you!
Add the following to your Nginx configuration (inside http or server block):
port_in_redirect off;
This should solve the problem.
Related
I have a website running at https://example.com:555
The 80 and 443 port for the same public ip have been forwarded to another server.
I only want to re-direct the url from http://example.com:555/1618/?id=877 to https://example.com:555/1618/?id=877
Right now I am getting the 400 error "Your browser sent a request that this server could not understand..."
I am using apache 2.4 on ubuntu 20.04
Any leads would be highly appreciated.
Thanks.
adding "ErrorDocument 400 https://example.com:555" in .htaccess
works but the id parameter is not passed
adding ErrorDocument in the localized-error-pages.conf in apache
works but the id parameter is not passed
configure Strict-Transport-Security
didnt work
trying different $1 , REQUEST_URI etc in .htaccess
did not work
These devices are all on the same LAN:
Ubuntu server
Win 10 PC
iPhone
Android
On the Ubuntu server, the /etc/hosts file has:
127.0.0.1 rcw.lt
Also on the Ubuntu server, there is a Laravel app hosted by nginx: server_name rcw.lt;.
The / homepage route of my rcw.lt app uses a redirect (see https://laravel.com/docs/8.x/redirects and https://laravel.com/docs/8.x/helpers#method-redirect).
I run lt --port 80 --local-host rcw.lt &.
What does NOT work:
When browsing from Win 10 or iPhone or Android to the URL generated for the rcw.lt app (such as https://fat-tiger-93.loca.lt), it always tries to redirect to https://rcw.lt (and says ERR_CONNECTION_REFUSED).
What works:
I can browse to the provided generated URL and append a specific path onto it (such as https://fat-tiger-93.loca.lt/some-specific-route), and it works. Or I can remove the redirect from the / route (which I don't want to do).
Any ideas?
Is this a problem with how Laravel redirects work? Or a problem with localtunnel? Is there a workaround?
I really appreciate your help. :-)
i have 2 projects running on different ports
localhost:7240
localhost:6040
I would like to have two custom domains like
website.dev -> that points to localhost:7240
admin.dev -> that points to localhost:6040
My host file
127.0.0.1 website.dev
127.0.0.1 admin.dev
and on browser i tryed those
http://website.dev/
http://website.dev:7240/
but none of them worked :/
but if i write
localhost:7240
localhost:6040
will work.
I apprecite any help. Thanks.
OMG !!
I make it work. Follow those rules.
dont user .dev, use something like .local
127.0.0.1 website.local
On chrome disable the https SSL enforcer
chrome://net-internals/#hsts, add the website.local in the Delete domain security policies1
Clear cache or history data
Vistin http://website.local:7240/ Dont forget the / at the end.
So we do have our Jekyll app that serves a static webpage, which includes a contact form.
This contact form request then gets passed (POST) to our Sinatra-app at http://sub.example.com/send_email to deliver an email to inform us about the new contact..
So far so good, everything works fine if we run the Sinatra-app by using
bundle exec rackup config.ru
However, upon starting nginx and passenger_ruby, our Sinatra app does not receive any data whatsoever.
We have set up the server like this:
server {
listen 80;
server_name sub.example.com;
error_log /home/example/error.log warn;
access_log /home/example/access.log;
passenger_enabled on;
passenger_ruby /home/example/.rbenv/shims/ruby;
root /home/example/evil_contact/public;
}
Now when accessing http://sub.example.com the access.log and error.log file do not have any entry. It is as if the request wouldn't arrive over at nginx or does not get passed through.
Let me know if there is something else needed.
Maybe we are just missing something obvious here.
Thank you in advance.
Alrighty,
After dozen of coffees the solution was not to change the nginx settings, but check the DNS records.
Afterall, the DNS entry had still a wrong IP assigned, so the request was going somewhere else.
I am attempting to configure an owncloud server that rewrites all incoming requests and ships them back out at the exact same domain and request uri but change the scheme from http to https.
This is failed miserably. I tried:
redirect 301 https://$hostname/$request_uri
and
rewrite ^ https://$hostname/$request_uri
Anyway, after removing that just to make sure the basic nginx configuration would work it as it had prior to adding the ssl redirects/rewrites it will NOT stop changing the scheme to https.
Is there a cached list somewhere in nginx's configuration that keeps hold of redirect/rewrite protocols? I cleared my browser cache completely and it will not stop.
AH HA!
in config/config.php there was a line
'forcessl' => true,
Stupid line got switched on when it received a request at the 443 port.
Turned off and standard http owncloud works and neither apache/nginx are redirecting to ssl.
Phew.