Configure nginx to workaround header issue in nopCommerce - asp.net

I have an Ubuntu VM running docker, with nopCommerce 4.30 and nginx. I wanted to add an authentication plugin, but I found out that there is a known issue https://github.com/nopSolutions/nopCommerce/issues/5584 that prevents these plugins from working while behind a reverse proxy. I am not able to update to 4.50 (version where the issue is fixed) or make changes to the current 4.30 image, other that changing configs like web.config and appsettings.json.
I need a way to fix this return_url address issue or some way to work around it.
One of the ideas I wanted to try is using nginx to replace the http with https in the request, but I do not know how to do it or if there is some sort of check that would prevent that.
Update: The nginx https replacement did not work, seems there is some kind of anti-tampering built in

From the HttpsRequirementAttribute action filter, you can see how nopCommerce handle the http==>https.
Please go to the bellow location
src==>Presentation==>Nop.Web.Framework==>Mvc==>Filters==>HttpsRequirementAttribute.cs
here you will see the switch case for HTTP to HTTPS. We comment out this code and handle it from the load balancer and web. config for http to https.
Also at the appsetting.json, we change something like bellow
"Hosting": {
"UseHttpClusterHttps": false,
"UseHttpXForwardedProto": false,
"ForwardedHttpHeader": ""
},
Hope this information will help you to deep down more about the issue.

Related

Drupal 8 Redirects to external URLs are not allowed by default

I am setting up a website with Drupal, the website is deployed on the live server through bitbucket pipelines. Normally when I browse to myurl.com/user it redirects me to myurl.com/user/login however now I get this error:
Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.
I have already set-up the "trusted_host_paterns" however this doesn't seem to fix the problem.
trusted host patterns:
$settings['trusted_host_patterns'] = array(
'^myurl\.com$',
);
Just in case somebody else comes here: It is also possible, that you have migrated a multi language site to a different server / localhost, and in your database are still the old redirect domains, that will now no longer work.
To fix this, you need to manually change the following value in the database. Go to dr_config and search for language.negotiation
In the cryptic blob, search have a look for something like
{s:6:"source";s:6:"domain";
and change it to
{s:6:"source";s:6:"path_prefix";
afterwards empty all cache_* tables (to force a reprocessing of the configuration) and there is a good chance it might work then.
The pattern seems OK to me. However there is what I'd check:
Confirm using your browser that the redirect to /user/login happens to exactly myurl.com domain. Not www.myurl.com for example.
Try clearing cache as well.
Then looking through this post on DO
And then this one. It's a D8 issue not fixed yet.
I remember having a similar issue on one of my websites during development on a local environment and the issue was really in the pattern.
In the case you have this because of a multilingual site not finding the domains on localhost, put in settings.php:
$config['language.negotiation']['url']['domains']['en'] = 'my-en-url.localhost';
$config['language.negotiation']['url']['domains']['de'] = 'my-de-url.localhost';
$config['language.negotiation']['url']['domains']['es'] = 'my-es-url.localhost';
$config['language.negotiation']['url']['domains']['fr'] = 'my-fr-url.localhost';

How to make POSBOX work with Nginx and SSL

I'm having trouble getting my Posboxes to work with my remote Odoo v10 server with Nginx and SSL.
I have tried configuring Nginx to send request to /pos/ over http. This results in a Mixed Content error in Safari and Chrome.
As I am using iPads, I cannot make Safari ignore this. This is also the result when I try to serve the /pos/ directory over https.
This results in the browser not being able to connect to the Posbox.
I've read and tried the solutions in these GitHub issues, with no success:
https://github.com/odoo/odoo/issues/2031
https://github.com/odoo/odoo/issues/3156
Does anyone have a working Nginx config example for use with Odoo 10?
if you are still facing this issue, then here is the fix. Please go through this blog:
https://webkul.com/blog/serve-odoo-posbox-over-https
I have also upgraded the ODOO POSBOX base image so that it will have nginx pre-installed in it, which can be easily connects with ODOO served over https.
Download Link : https://drive.google.com/file/d/0B1dx-UuV9AOYbWZSNG1GVjBPOTQ
I hope it will work.

Phabricator: running over https, doesn't load any images. Firefox reports blocking unencrypted content

Phabricator: running over https, doesn't load any images. Firefox reports blocking unencrypted content.
If I click that little shield thingy next to 'https', and select "Disable protection for now" with "Options" button, things seem to work fine.
I added https:// in phabricator.production-uri and phabricator.allowed-uris with no luck.
Found it:
bin/config set phabricator.base-uri https://<your-base-url>
bin/phd restart
I had previously added that https url in phabricator.production-uri and phabricator.allowed-uris (I don't know if that mattered).
Warning: At one point, I was able to complete messup the login screen. Probably because I didn't run bin/phd restart. If that happens, restore phabricator.base-uri to its previous value.
In addition to setting phabricator.base-uri, you may also need to change security.alternate-file-domain to use HTTPS. Read https://secure.phabricator.com/book/phabricator/article/configuring_file_domain/ to find more about this setting.
Alternatively, you can simply delete the setting by running bin/config delete security.alternate-file-domain.
This same issue occurred to me after installing a TLS certificate.
Setting the base-uri option did not work for me, nor did the production or allowed uri options.
What solved it was setting the security.alternate-file-domain parameter to the https url, as explained here: https://secure.phabricator.com/book/phabricator/article/configuring_file_domain/
Perhaps this isn't the optimal solution, but it's not clear what else to do.
My setup: Bitnami Phabricator pre-configured instance over AWS.
Looks like now the way to go is to screate a support/preamble.php which contains nothing but
<?php
$_SERVER['HTTPS'] = true;
as described here

Meteor JS behind a proxy

I'm trying to use Meteor from behind a proxy. I've tried setting environment variables for proxy details as the docs but it has not helped.
SET HTTP_PROXY=http://user:password#1.2.3.4:5678
SET HTTPS_PROXY=http://user:password#1.2.3.4:5678
meteor update
Instead I want to bypass the proxy for the certain URLs that Meteor needs. I have identified atmospherejs.com and registry.npmjs.org (not sure if meteor uses this directly but we are also working with node separately).
Are there any other URLs that Meteor will need?
Here are some:
docs.meteor.com
s3-1.amazonaws.com
activity.meteor.com
warehouse.meteor.com
registry.npmjs.org
registry.npmjs.org
packages.meteor.com
I can't imagine that it's a specific domain causing your problem tough.

Moved Drupal 7 site to a different server, can't log in

I recently moved my Drupal 7 site to a new hosting server and I'm stuck at the login page. As soon as I try and log in, I get directed back to the same page, but the URL changes from /user to /user/1, which leads me to believe that I am actually logged in, but I'm not being forwarded to the correct page.
I tried cleaning my cache, emptying the cache tables in the DB but nothing helped.
Any ideas?
EDIT: To make things a bit more clear, I've used the specific server for various other Drupal 7 sites, so I know for a fact that the server configuration is not at fault here.
I suspect your $cookie_domain in /sites/default/settings.php is incorrect.
Try making it match your new domain and ensure there's a leading dot .
$cookie_domain = '.mydomain.co.uk';
Sometimes problems relating to logging in after a site migration can be because mod_rewrite was enabled on the first machine but not the second. A simple way to test this is to use the ?q= URL format (http://site.localhost?q=user) and see if you can log in like that. If that works then you can either disable clean urls from within the Drupal interface, or enable mod rewrite in Apache.
In my case the issue was solved only after refreshing .htaccess file in drupal root folder.
You can take the source here: https://github.com/drupal/drupal/blob/7.x/.htaccess
seddonym's comment about mod_rewrite led me to a slightly different solution. I was having the same problem but was able to solve it by copying the file rewrite.load from /etc/apache2/mods-available to /etc/apache2/mods-enabled.
I think the files in mods-enabled are some sort of link files (I am novice at linux still) but copying the files worked just fine. Maybe someone will come along and tell us the proper way to do this.
Sometimes all you need is to clear the cookies for the domain/website - it's possible you have old cookies alive that are causing this.
Get a cookie manager to help simplify this, e.g.:
Edit This Cookie (for Chrome)
Other answer might be that rewrite php module is not installed, to do that do the followings:
sudo a2enmod rewrite
Restart apache2
sudo service apache2 restart
In my case it was very stupid, on my page.tpl.php, there wasn't any "content" and the page--user.tpl.php didn't get read. Only had the line to show content in the page.tpl.php
Although that it is unlikely that you're as stupid as me. ;) Maybe it will be helpful anyway.
Arne

Resources